diff options
Diffstat (limited to 'src/Wallabag/ImportBundle')
6 files changed, 24 insertions, 14 deletions
diff --git a/src/Wallabag/ImportBundle/Controller/PocketController.php b/src/Wallabag/ImportBundle/Controller/PocketController.php index 7a35514b..1d804219 100644 --- a/src/Wallabag/ImportBundle/Controller/PocketController.php +++ b/src/Wallabag/ImportBundle/Controller/PocketController.php | |||
@@ -52,8 +52,9 @@ class PocketController extends Controller | |||
52 | */ | 52 | */ |
53 | public function callbackAction() | 53 | public function callbackAction() |
54 | { | 54 | { |
55 | $message = 'Import failed, please try again.'; | 55 | $message = 'flashes.import.notice.failed'; |
56 | $pocket = $this->get('wallabag_import.pocket.import'); | 56 | $pocket = $this->get('wallabag_import.pocket.import'); |
57 | |||
57 | $markAsRead = $this->get('session')->get('mark_as_read'); | 58 | $markAsRead = $this->get('session')->get('mark_as_read'); |
58 | $this->get('session')->remove('mark_as_read'); | 59 | $this->get('session')->remove('mark_as_read'); |
59 | 60 | ||
@@ -69,7 +70,10 @@ class PocketController extends Controller | |||
69 | 70 | ||
70 | if (true === $pocket->setMarkAsRead($markAsRead)->import()) { | 71 | if (true === $pocket->setMarkAsRead($markAsRead)->import()) { |
71 | $summary = $pocket->getSummary(); | 72 | $summary = $pocket->getSummary(); |
72 | $message = 'Import summary: '.$summary['imported'].' imported, '.$summary['skipped'].' already saved.'; | 73 | $message = $this->get('translator')->trans('flashes.import.notice.summary', array( |
74 | '%imported%' => $summary['imported'], | ||
75 | '%skipped%' => $summary['skipped'], | ||
76 | )); | ||
73 | } | 77 | } |
74 | 78 | ||
75 | $this->get('session')->getFlashBag()->add( | 79 | $this->get('session')->getFlashBag()->add( |
diff --git a/src/Wallabag/ImportBundle/Controller/WallabagV1Controller.php b/src/Wallabag/ImportBundle/Controller/WallabagV1Controller.php index 154a0769..1bc9696d 100644 --- a/src/Wallabag/ImportBundle/Controller/WallabagV1Controller.php +++ b/src/Wallabag/ImportBundle/Controller/WallabagV1Controller.php | |||
@@ -31,11 +31,14 @@ class WallabagV1Controller extends Controller | |||
31 | ->setMarkAsRead($markAsRead) | 31 | ->setMarkAsRead($markAsRead) |
32 | ->import(); | 32 | ->import(); |
33 | 33 | ||
34 | $message = 'Import failed, please try again.'; | 34 | $message = 'flashes.import.notice.failed'; |
35 | 35 | ||
36 | if (true === $res) { | 36 | if (true === $res) { |
37 | $summary = $wallabag->getSummary(); | 37 | $summary = $wallabag->getSummary(); |
38 | $message = 'Import summary: '.$summary['imported'].' imported, '.$summary['skipped'].' already saved.'; | 38 | $message = $this->get('translator')->trans('flashes.import.notice.summary', array( |
39 | '%imported%' => $summary['imported'], | ||
40 | '%skipped%' => $summary['skipped'], | ||
41 | )); | ||
39 | 42 | ||
40 | unlink($this->getParameter('wallabag_import.resource_dir').'/'.$name); | 43 | unlink($this->getParameter('wallabag_import.resource_dir').'/'.$name); |
41 | } | 44 | } |
@@ -49,7 +52,7 @@ class WallabagV1Controller extends Controller | |||
49 | } else { | 52 | } else { |
50 | $this->get('session')->getFlashBag()->add( | 53 | $this->get('session')->getFlashBag()->add( |
51 | 'notice', | 54 | 'notice', |
52 | 'Error while processing import. Please verify your import file.' | 55 | 'flashes.import.notice.failed_on_file' |
53 | ); | 56 | ); |
54 | } | 57 | } |
55 | } | 58 | } |
diff --git a/src/Wallabag/ImportBundle/Controller/WallabagV2Controller.php b/src/Wallabag/ImportBundle/Controller/WallabagV2Controller.php index 6dcd204a..3e6428a0 100644 --- a/src/Wallabag/ImportBundle/Controller/WallabagV2Controller.php +++ b/src/Wallabag/ImportBundle/Controller/WallabagV2Controller.php | |||
@@ -31,11 +31,14 @@ class WallabagV2Controller extends Controller | |||
31 | ->setMarkAsRead($markAsRead) | 31 | ->setMarkAsRead($markAsRead) |
32 | ->import(); | 32 | ->import(); |
33 | 33 | ||
34 | $message = 'Import failed, please try again.'; | 34 | $message = 'flashes.import.notice.failed'; |
35 | 35 | ||
36 | if (true === $res) { | 36 | if (true === $res) { |
37 | $summary = $wallabag->getSummary(); | 37 | $summary = $wallabag->getSummary(); |
38 | $message = 'Import summary: '.$summary['imported'].' imported, '.$summary['skipped'].' already saved.'; | 38 | $message = $this->get('translator')->trans('flashes.import.notice.summary', array( |
39 | '%imported%' => $summary['imported'], | ||
40 | '%skipped%' => $summary['skipped'], | ||
41 | )); | ||
39 | 42 | ||
40 | unlink($this->getParameter('wallabag_import.resource_dir').'/'.$name); | 43 | unlink($this->getParameter('wallabag_import.resource_dir').'/'.$name); |
41 | } | 44 | } |
@@ -49,7 +52,7 @@ class WallabagV2Controller extends Controller | |||
49 | } else { | 52 | } else { |
50 | $this->get('session')->getFlashBag()->add( | 53 | $this->get('session')->getFlashBag()->add( |
51 | 'notice', | 54 | 'notice', |
52 | 'Error while processing import. Please verify your import file.' | 55 | 'flashes.import.notice.failed_on_file' |
53 | ); | 56 | ); |
54 | } | 57 | } |
55 | } | 58 | } |
diff --git a/src/Wallabag/ImportBundle/Tests/Controller/PocketControllerTest.php b/src/Wallabag/ImportBundle/Tests/Controller/PocketControllerTest.php index c2acd68c..174641fd 100644 --- a/src/Wallabag/ImportBundle/Tests/Controller/PocketControllerTest.php +++ b/src/Wallabag/ImportBundle/Tests/Controller/PocketControllerTest.php | |||
@@ -37,6 +37,6 @@ class PocketControllerTest extends WallabagCoreTestCase | |||
37 | 37 | ||
38 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | 38 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); |
39 | $this->assertContains('import/pocket', $client->getResponse()->headers->get('location')); | 39 | $this->assertContains('import/pocket', $client->getResponse()->headers->get('location')); |
40 | $this->assertEquals('Import failed, please try again.', $client->getContainer()->get('session')->getFlashBag()->peek('notice')[0]); | 40 | $this->assertEquals('flashes.import.notice.failed', $client->getContainer()->get('session')->getFlashBag()->peek('notice')[0]); |
41 | } | 41 | } |
42 | } | 42 | } |
diff --git a/src/Wallabag/ImportBundle/Tests/Controller/WallabagV1ControllerTest.php b/src/Wallabag/ImportBundle/Tests/Controller/WallabagV1ControllerTest.php index 6c876b3b..8d353a71 100644 --- a/src/Wallabag/ImportBundle/Tests/Controller/WallabagV1ControllerTest.php +++ b/src/Wallabag/ImportBundle/Tests/Controller/WallabagV1ControllerTest.php | |||
@@ -55,7 +55,7 @@ class WallabagV1ControllerTest extends WallabagCoreTestCase | |||
55 | $this->assertTrue($content->getTags()->contains($tag)); | 55 | $this->assertTrue($content->getTags()->contains($tag)); |
56 | 56 | ||
57 | $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(array('_text'))); | 57 | $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(array('_text'))); |
58 | $this->assertContains('Import summary', $body[0]); | 58 | $this->assertContains('flashes.import.notice.summary', $body[0]); |
59 | } | 59 | } |
60 | 60 | ||
61 | public function testImportWallabagWithFileAndMarkAllAsRead() | 61 | public function testImportWallabagWithFileAndMarkAllAsRead() |
@@ -100,7 +100,7 @@ class WallabagV1ControllerTest extends WallabagCoreTestCase | |||
100 | $this->assertTrue($content2->isArchived()); | 100 | $this->assertTrue($content2->isArchived()); |
101 | 101 | ||
102 | $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(array('_text'))); | 102 | $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(array('_text'))); |
103 | $this->assertContains('Import summary', $body[0]); | 103 | $this->assertContains('flashes.import.notice.summary', $body[0]); |
104 | } | 104 | } |
105 | 105 | ||
106 | public function testImportWallabagWithEmptyFile() | 106 | public function testImportWallabagWithEmptyFile() |
@@ -124,6 +124,6 @@ class WallabagV1ControllerTest extends WallabagCoreTestCase | |||
124 | $crawler = $client->followRedirect(); | 124 | $crawler = $client->followRedirect(); |
125 | 125 | ||
126 | $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(array('_text'))); | 126 | $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(array('_text'))); |
127 | $this->assertContains('Import failed, please try again', $body[0]); | 127 | $this->assertContains('flashes.import.notice.failed', $body[0]); |
128 | } | 128 | } |
129 | } | 129 | } |
diff --git a/src/Wallabag/ImportBundle/Tests/Controller/WallabagV2ControllerTest.php b/src/Wallabag/ImportBundle/Tests/Controller/WallabagV2ControllerTest.php index 58baa836..bcbd6305 100644 --- a/src/Wallabag/ImportBundle/Tests/Controller/WallabagV2ControllerTest.php +++ b/src/Wallabag/ImportBundle/Tests/Controller/WallabagV2ControllerTest.php | |||
@@ -40,7 +40,7 @@ class WallabagV2ControllerTest extends WallabagCoreTestCase | |||
40 | $crawler = $client->followRedirect(); | 40 | $crawler = $client->followRedirect(); |
41 | 41 | ||
42 | $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(array('_text'))); | 42 | $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(array('_text'))); |
43 | $this->assertContains('Import summary', $body[0]); | 43 | $this->assertContains('flashes.import.notice.summary', $body[0]); |
44 | 44 | ||
45 | $content = $client->getContainer() | 45 | $content = $client->getContainer() |
46 | ->get('doctrine.orm.entity_manager') | 46 | ->get('doctrine.orm.entity_manager') |
@@ -88,6 +88,6 @@ class WallabagV2ControllerTest extends WallabagCoreTestCase | |||
88 | $crawler = $client->followRedirect(); | 88 | $crawler = $client->followRedirect(); |
89 | 89 | ||
90 | $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(array('_text'))); | 90 | $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(array('_text'))); |
91 | $this->assertContains('Import failed, please try again', $body[0]); | 91 | $this->assertContains('flashes.import.notice.failed', $body[0]); |
92 | } | 92 | } |
93 | } | 93 | } |