]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - src/Wallabag/ImportBundle/Controller/WallabagV2Controller.php
Merge pull request #1774 from wallabag/v2-key-translation
[github/wallabag/wallabag.git] / src / Wallabag / ImportBundle / Controller / WallabagV2Controller.php
index 2e6225f295ec15146e9cdb1c4dc259fd7b37e0d1..3e6428a049903c72c094be73df5341feb970565a 100644 (file)
@@ -21,19 +21,24 @@ class WallabagV2Controller extends Controller
 
         if ($form->isValid()) {
             $file = $form->get('file')->getData();
+            $markAsRead = $form->get('mark_as_read')->getData();
             $name = $this->getUser()->getId().'.json';
 
             if (in_array($file->getClientMimeType(), $this->getParameter('wallabag_import.allow_mimetypes')) && $file->move($this->getParameter('wallabag_import.resource_dir'), $name)) {
                 $res = $wallabag
                     ->setUser($this->getUser())
                     ->setFilepath($this->getParameter('wallabag_import.resource_dir').'/'.$name)
+                    ->setMarkAsRead($markAsRead)
                     ->import();
 
-                $message = 'Import failed, please try again.';
+                $message = 'flashes.import.notice.failed';
 
                 if (true === $res) {
                     $summary = $wallabag->getSummary();
-                    $message = 'Import summary: '.$summary['imported'].' imported, '.$summary['skipped'].' already saved.';
+                    $message = $this->get('translator')->trans('flashes.import.notice.summary', array(
+                        '%imported%' => $summary['imported'],
+                        '%skipped%' => $summary['skipped'],
+                    ));
 
                     unlink($this->getParameter('wallabag_import.resource_dir').'/'.$name);
                 }
@@ -47,7 +52,7 @@ class WallabagV2Controller extends Controller
             } else {
                 $this->get('session')->getFlashBag()->add(
                     'notice',
-                    'Error while processing import. Please verify your import file.'
+                    'flashes.import.notice.failed_on_file'
                 );
             }
         }