diff options
Diffstat (limited to 'src')
11 files changed, 94 insertions, 40 deletions
diff --git a/src/Wallabag/CoreBundle/Controller/ConfigController.php b/src/Wallabag/CoreBundle/Controller/ConfigController.php index d24066b3..779be268 100644 --- a/src/Wallabag/CoreBundle/Controller/ConfigController.php +++ b/src/Wallabag/CoreBundle/Controller/ConfigController.php | |||
@@ -45,7 +45,7 @@ class ConfigController extends Controller | |||
45 | 45 | ||
46 | $this->get('session')->getFlashBag()->add( | 46 | $this->get('session')->getFlashBag()->add( |
47 | 'notice', | 47 | 'notice', |
48 | 'Config saved. Some parameters will be considered after disconnection.' | 48 | 'flashes.config.notice.config_saved' |
49 | ); | 49 | ); |
50 | 50 | ||
51 | return $this->redirect($this->generateUrl('config')); | 51 | return $this->redirect($this->generateUrl('config')); |
@@ -57,9 +57,9 @@ class ConfigController extends Controller | |||
57 | 57 | ||
58 | if ($pwdForm->isValid()) { | 58 | if ($pwdForm->isValid()) { |
59 | if ($this->get('craue_config')->get('demo_mode_enabled') && $this->get('craue_config')->get('demo_mode_username') === $user->getUsername()) { | 59 | if ($this->get('craue_config')->get('demo_mode_enabled') && $this->get('craue_config')->get('demo_mode_username') === $user->getUsername()) { |
60 | $message = 'In demonstration mode, you can\'t change password for this user.'; | 60 | $message = 'flashes.config.notice.password_not_updated_demo'; |
61 | } else { | 61 | } else { |
62 | $message = 'Password updated'; | 62 | $message = 'flashes.config.notice.password_updated'; |
63 | 63 | ||
64 | $user->setPlainPassword($pwdForm->get('new_password')->getData()); | 64 | $user->setPlainPassword($pwdForm->get('new_password')->getData()); |
65 | $userManager->updateUser($user, true); | 65 | $userManager->updateUser($user, true); |
@@ -82,7 +82,7 @@ class ConfigController extends Controller | |||
82 | 82 | ||
83 | $this->get('session')->getFlashBag()->add( | 83 | $this->get('session')->getFlashBag()->add( |
84 | 'notice', | 84 | 'notice', |
85 | 'Information updated' | 85 | 'flashes.config.notice.user_updated' |
86 | ); | 86 | ); |
87 | 87 | ||
88 | return $this->redirect($this->generateUrl('config').'#set3'); | 88 | return $this->redirect($this->generateUrl('config').'#set3'); |
@@ -98,7 +98,7 @@ class ConfigController extends Controller | |||
98 | 98 | ||
99 | $this->get('session')->getFlashBag()->add( | 99 | $this->get('session')->getFlashBag()->add( |
100 | 'notice', | 100 | 'notice', |
101 | 'RSS information updated' | 101 | 'flashes.config.notice.rss_updated' |
102 | ); | 102 | ); |
103 | 103 | ||
104 | return $this->redirect($this->generateUrl('config').'#set2'); | 104 | return $this->redirect($this->generateUrl('config').'#set2'); |
@@ -116,7 +116,7 @@ class ConfigController extends Controller | |||
116 | 116 | ||
117 | $this->get('session')->getFlashBag()->add( | 117 | $this->get('session')->getFlashBag()->add( |
118 | 'notice', | 118 | 'notice', |
119 | 'Tagging rules updated' | 119 | 'flashes.config.notice.tagging_rules_updated' |
120 | ); | 120 | ); |
121 | 121 | ||
122 | return $this->redirect($this->generateUrl('config').'#set5'); | 122 | return $this->redirect($this->generateUrl('config').'#set5'); |
@@ -147,7 +147,7 @@ class ConfigController extends Controller | |||
147 | 147 | ||
148 | $this->get('session')->getFlashBag()->add( | 148 | $this->get('session')->getFlashBag()->add( |
149 | 'notice', | 149 | 'notice', |
150 | $this->get('translator')->trans('User "%username%" added', array('%username%' => $newUser->getUsername())) | 150 | $this->get('translator')->trans('flashes.config.notice.user_added', array('%username%' => $newUser->getUsername())) |
151 | ); | 151 | ); |
152 | 152 | ||
153 | return $this->redirect($this->generateUrl('config').'#set6'); | 153 | return $this->redirect($this->generateUrl('config').'#set6'); |
@@ -192,7 +192,7 @@ class ConfigController extends Controller | |||
192 | 192 | ||
193 | $this->get('session')->getFlashBag()->add( | 193 | $this->get('session')->getFlashBag()->add( |
194 | 'notice', | 194 | 'notice', |
195 | 'RSS token updated' | 195 | 'flashes.config.notice.rss_token_updated' |
196 | ); | 196 | ); |
197 | 197 | ||
198 | return $this->redirect($this->generateUrl('config').'#set2'); | 198 | return $this->redirect($this->generateUrl('config').'#set2'); |
@@ -219,7 +219,7 @@ class ConfigController extends Controller | |||
219 | 219 | ||
220 | $this->get('session')->getFlashBag()->add( | 220 | $this->get('session')->getFlashBag()->add( |
221 | 'notice', | 221 | 'notice', |
222 | 'Tagging rule deleted' | 222 | 'flashes.config.notice.tagging_rules_deleted' |
223 | ); | 223 | ); |
224 | 224 | ||
225 | return $this->redirect($this->generateUrl('config').'#set5'); | 225 | return $this->redirect($this->generateUrl('config').'#set5'); |
diff --git a/src/Wallabag/CoreBundle/Controller/EntryController.php b/src/Wallabag/CoreBundle/Controller/EntryController.php index 0fae3a0f..1a0b80ac 100644 --- a/src/Wallabag/CoreBundle/Controller/EntryController.php +++ b/src/Wallabag/CoreBundle/Controller/EntryController.php | |||
@@ -55,7 +55,7 @@ class EntryController extends Controller | |||
55 | if (false !== $existingEntry) { | 55 | if (false !== $existingEntry) { |
56 | $this->get('session')->getFlashBag()->add( | 56 | $this->get('session')->getFlashBag()->add( |
57 | 'notice', | 57 | 'notice', |
58 | 'Entry already saved on '.$existingEntry->getCreatedAt()->format('d-m-Y') | 58 | $this->get('translator')->trans('flashes.entry.notice.entry_already_saved', array('%date%' => $existingEntry->getCreatedAt()->format('d-m-Y'))) |
59 | ); | 59 | ); |
60 | 60 | ||
61 | return $this->redirect($this->generateUrl('view', array('id' => $existingEntry->getId()))); | 61 | return $this->redirect($this->generateUrl('view', array('id' => $existingEntry->getId()))); |
@@ -64,7 +64,7 @@ class EntryController extends Controller | |||
64 | $this->updateEntry($entry); | 64 | $this->updateEntry($entry); |
65 | $this->get('session')->getFlashBag()->add( | 65 | $this->get('session')->getFlashBag()->add( |
66 | 'notice', | 66 | 'notice', |
67 | 'Entry saved' | 67 | 'flashes.entry.notice.entry_saved' |
68 | ); | 68 | ); |
69 | 69 | ||
70 | return $this->redirect($this->generateUrl('homepage')); | 70 | return $this->redirect($this->generateUrl('homepage')); |
@@ -128,7 +128,7 @@ class EntryController extends Controller | |||
128 | 128 | ||
129 | $this->get('session')->getFlashBag()->add( | 129 | $this->get('session')->getFlashBag()->add( |
130 | 'notice', | 130 | 'notice', |
131 | 'Entry updated' | 131 | 'flashes.entry.notice.entry_updated' |
132 | ); | 132 | ); |
133 | 133 | ||
134 | return $this->redirect($this->generateUrl('view', array('id' => $entry->getId()))); | 134 | return $this->redirect($this->generateUrl('view', array('id' => $entry->getId()))); |
@@ -304,9 +304,9 @@ class EntryController extends Controller | |||
304 | { | 304 | { |
305 | $this->checkUserAction($entry); | 305 | $this->checkUserAction($entry); |
306 | 306 | ||
307 | $message = 'Entry reloaded'; | 307 | $message = 'flashes.entry.notice.entry_reloaded'; |
308 | if (false === $this->updateEntry($entry)) { | 308 | if (false === $this->updateEntry($entry)) { |
309 | $message = 'Failed to reload entry'; | 309 | $message = 'flashes.entry.notice.entry_reload_failed'; |
310 | } | 310 | } |
311 | 311 | ||
312 | $this->get('session')->getFlashBag()->add( | 312 | $this->get('session')->getFlashBag()->add( |
@@ -334,9 +334,14 @@ class EntryController extends Controller | |||
334 | $entry->toggleArchive(); | 334 | $entry->toggleArchive(); |
335 | $this->getDoctrine()->getManager()->flush(); | 335 | $this->getDoctrine()->getManager()->flush(); |
336 | 336 | ||
337 | $message = 'flashes.entry.notice.entry_unarchived'; | ||
338 | if ($entry->isArchived()) { | ||
339 | $message = 'flashes.entry.notice.entry_archived'; | ||
340 | } | ||
341 | |||
337 | $this->get('session')->getFlashBag()->add( | 342 | $this->get('session')->getFlashBag()->add( |
338 | 'notice', | 343 | 'notice', |
339 | 'Entry '.($entry->isArchived() ? 'archived' : 'unarchived') | 344 | $message |
340 | ); | 345 | ); |
341 | 346 | ||
342 | return $this->redirect($request->headers->get('referer')); | 347 | return $this->redirect($request->headers->get('referer')); |
@@ -359,9 +364,14 @@ class EntryController extends Controller | |||
359 | $entry->toggleStar(); | 364 | $entry->toggleStar(); |
360 | $this->getDoctrine()->getManager()->flush(); | 365 | $this->getDoctrine()->getManager()->flush(); |
361 | 366 | ||
367 | $message = 'flashes.entry.notice.entry_unstarred'; | ||
368 | if ($entry->isStarred()) { | ||
369 | $message = 'flashes.entry.notice.entry_starred'; | ||
370 | } | ||
371 | |||
362 | $this->get('session')->getFlashBag()->add( | 372 | $this->get('session')->getFlashBag()->add( |
363 | 'notice', | 373 | 'notice', |
364 | 'Entry '.($entry->isStarred() ? 'starred' : 'unstarred') | 374 | $message |
365 | ); | 375 | ); |
366 | 376 | ||
367 | return $this->redirect($request->headers->get('referer')); | 377 | return $this->redirect($request->headers->get('referer')); |
@@ -394,7 +404,7 @@ class EntryController extends Controller | |||
394 | 404 | ||
395 | $this->get('session')->getFlashBag()->add( | 405 | $this->get('session')->getFlashBag()->add( |
396 | 'notice', | 406 | 'notice', |
397 | 'Entry deleted' | 407 | 'flashes.entry.notice.entry_deleted' |
398 | ); | 408 | ); |
399 | 409 | ||
400 | // don't redirect user to the deleted entry | 410 | // don't redirect user to the deleted entry |
diff --git a/src/Wallabag/CoreBundle/Controller/TagController.php b/src/Wallabag/CoreBundle/Controller/TagController.php index 7b34939d..56e5195c 100644 --- a/src/Wallabag/CoreBundle/Controller/TagController.php +++ b/src/Wallabag/CoreBundle/Controller/TagController.php | |||
@@ -43,7 +43,7 @@ class TagController extends Controller | |||
43 | 43 | ||
44 | $this->get('session')->getFlashBag()->add( | 44 | $this->get('session')->getFlashBag()->add( |
45 | 'notice', | 45 | 'notice', |
46 | 'Tag added' | 46 | 'flashes.tag.notice.tag_added' |
47 | ); | 47 | ); |
48 | 48 | ||
49 | return $this->redirect($this->generateUrl('view', array('id' => $entry->getId()))); | 49 | return $this->redirect($this->generateUrl('view', array('id' => $entry->getId()))); |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml index 22039de3..c8a1973b 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml | |||
@@ -332,3 +332,37 @@ validator: | |||
332 | password_wrong_value: 'Wrong value for your current password' | 332 | password_wrong_value: 'Wrong value for your current password' |
333 | item_per_page_too_high: 'This will certainly kill the app' | 333 | item_per_page_too_high: 'This will certainly kill the app' |
334 | rss_limit_too_hight: 'This will certainly kill the app' | 334 | rss_limit_too_hight: 'This will certainly kill the app' |
335 | |||
336 | flashes: | ||
337 | config: | ||
338 | notice: | ||
339 | config_saved: 'Config saved. Some parameters will be considered after disconnection.' | ||
340 | password_updated: 'Password updated' | ||
341 | password_not_updated_demo: "In demonstration mode, you can't change password for this user." | ||
342 | user_updated: 'Information updated' | ||
343 | rss_updated: 'RSS information updated' | ||
344 | tagging_rules_updated: 'Tagging rules updated' | ||
345 | tagging_rules_deleted: 'Tagging rule deleted' | ||
346 | user_added: 'User "%username%" added' | ||
347 | rss_token_updated: 'RSS token updated' | ||
348 | entry: | ||
349 | notice: | ||
350 | entry_already_saved: 'Entry already saved on %date%' | ||
351 | entry_saved: 'Entry saved' | ||
352 | entry_updated: 'Entry updated' | ||
353 | entry_reloaded: 'Entry reloaded' | ||
354 | entry_reload_failed: 'Failed to reload entry' | ||
355 | entry_archived: 'Entry archived' | ||
356 | entry_unarchived: 'Entry unarchived' | ||
357 | entry_starred: 'Entry starred' | ||
358 | entry_unstarred: 'Entry unstarred' | ||
359 | entry_deleted: 'Entry deleted' | ||
360 | tag: | ||
361 | notice: | ||
362 | tag_added: 'Tag added' | ||
363 | import: | ||
364 | notice: | ||
365 | failed: 'Import failed, please try again.' | ||
366 | failed_on_file: 'Error while processing import. Please verify your import file.' | ||
367 | summary: 'Import summary: %imported% imported, %skipped% already saved.' | ||
368 | |||
diff --git a/src/Wallabag/CoreBundle/Tests/Controller/ConfigControllerTest.php b/src/Wallabag/CoreBundle/Tests/Controller/ConfigControllerTest.php index 884e740e..f2d26750 100644 --- a/src/Wallabag/CoreBundle/Tests/Controller/ConfigControllerTest.php +++ b/src/Wallabag/CoreBundle/Tests/Controller/ConfigControllerTest.php | |||
@@ -57,7 +57,7 @@ class ConfigControllerTest extends WallabagCoreTestCase | |||
57 | $crawler = $client->followRedirect(); | 57 | $crawler = $client->followRedirect(); |
58 | 58 | ||
59 | $this->assertGreaterThan(1, $alert = $crawler->filter('div.messages.success')->extract(array('_text'))); | 59 | $this->assertGreaterThan(1, $alert = $crawler->filter('div.messages.success')->extract(array('_text'))); |
60 | $this->assertContains('Config saved', $alert[0]); | 60 | $this->assertContains('flashes.config.notice.config_saved', $alert[0]); |
61 | } | 61 | } |
62 | 62 | ||
63 | public function dataForUpdateFailed() | 63 | public function dataForUpdateFailed() |
@@ -177,7 +177,7 @@ class ConfigControllerTest extends WallabagCoreTestCase | |||
177 | $crawler = $client->followRedirect(); | 177 | $crawler = $client->followRedirect(); |
178 | 178 | ||
179 | $this->assertGreaterThan(1, $alert = $crawler->filter('div.messages.success')->extract(array('_text'))); | 179 | $this->assertGreaterThan(1, $alert = $crawler->filter('div.messages.success')->extract(array('_text'))); |
180 | $this->assertContains('Password updated', $alert[0]); | 180 | $this->assertContains('flashes.config.notice.password_updated', $alert[0]); |
181 | } | 181 | } |
182 | 182 | ||
183 | public function dataForUserFailed() | 183 | public function dataForUserFailed() |
@@ -245,7 +245,7 @@ class ConfigControllerTest extends WallabagCoreTestCase | |||
245 | $crawler = $client->followRedirect(); | 245 | $crawler = $client->followRedirect(); |
246 | 246 | ||
247 | $this->assertGreaterThan(1, $alert = $crawler->filter('body')->extract(array('_text'))); | 247 | $this->assertGreaterThan(1, $alert = $crawler->filter('body')->extract(array('_text'))); |
248 | $this->assertContains('Information updated', $alert[0]); | 248 | $this->assertContains('flashes.config.notice.user_updated', $alert[0]); |
249 | } | 249 | } |
250 | 250 | ||
251 | public function dataForNewUserFailed() | 251 | public function dataForNewUserFailed() |
@@ -346,7 +346,7 @@ class ConfigControllerTest extends WallabagCoreTestCase | |||
346 | $crawler = $client->followRedirect(); | 346 | $crawler = $client->followRedirect(); |
347 | 347 | ||
348 | $this->assertGreaterThan(1, $alert = $crawler->filter('div.messages.success')->extract(array('_text'))); | 348 | $this->assertGreaterThan(1, $alert = $crawler->filter('div.messages.success')->extract(array('_text'))); |
349 | $this->assertContains('User "wallace" added', $alert[0]); | 349 | $this->assertContains('flashes.config.notice.user_added', $alert[0]); |
350 | 350 | ||
351 | $em = $client->getContainer()->get('doctrine.orm.entity_manager'); | 351 | $em = $client->getContainer()->get('doctrine.orm.entity_manager'); |
352 | $user = $em | 352 | $user = $em |
@@ -433,7 +433,7 @@ class ConfigControllerTest extends WallabagCoreTestCase | |||
433 | $crawler = $client->followRedirect(); | 433 | $crawler = $client->followRedirect(); |
434 | 434 | ||
435 | $this->assertGreaterThan(1, $alert = $crawler->filter('div.messages.success')->extract(array('_text'))); | 435 | $this->assertGreaterThan(1, $alert = $crawler->filter('div.messages.success')->extract(array('_text'))); |
436 | $this->assertContains('RSS information updated', $alert[0]); | 436 | $this->assertContains('flashes.config.notice.rss_updated', $alert[0]); |
437 | } | 437 | } |
438 | 438 | ||
439 | public function dataForRssFailed() | 439 | public function dataForRssFailed() |
@@ -499,7 +499,7 @@ class ConfigControllerTest extends WallabagCoreTestCase | |||
499 | $crawler = $client->followRedirect(); | 499 | $crawler = $client->followRedirect(); |
500 | 500 | ||
501 | $this->assertGreaterThan(1, $alert = $crawler->filter('div.messages.success')->extract(array('_text'))); | 501 | $this->assertGreaterThan(1, $alert = $crawler->filter('div.messages.success')->extract(array('_text'))); |
502 | $this->assertContains('Tagging rules updated', $alert[0]); | 502 | $this->assertContains('flashes.config.notice.tagging_rules_updated', $alert[0]); |
503 | 503 | ||
504 | $deleteLink = $crawler->filter('.delete')->last()->link(); | 504 | $deleteLink = $crawler->filter('.delete')->last()->link(); |
505 | 505 | ||
@@ -508,7 +508,7 @@ class ConfigControllerTest extends WallabagCoreTestCase | |||
508 | 508 | ||
509 | $crawler = $client->followRedirect(); | 509 | $crawler = $client->followRedirect(); |
510 | $this->assertGreaterThan(1, $alert = $crawler->filter('div.messages.success')->extract(array('_text'))); | 510 | $this->assertGreaterThan(1, $alert = $crawler->filter('div.messages.success')->extract(array('_text'))); |
511 | $this->assertContains('Tagging rule deleted', $alert[0]); | 511 | $this->assertContains('flashes.config.notice.tagging_rules_deleted', $alert[0]); |
512 | } | 512 | } |
513 | 513 | ||
514 | public function dataForTaggingRuleFailed() | 514 | public function dataForTaggingRuleFailed() |
@@ -602,7 +602,7 @@ class ConfigControllerTest extends WallabagCoreTestCase | |||
602 | $client->submit($form, $data); | 602 | $client->submit($form, $data); |
603 | 603 | ||
604 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | 604 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); |
605 | $this->assertContains('In demonstration mode, you can\'t change password for this user.', $client->getContainer()->get('session')->getFlashBag()->get('notice')[0]); | 605 | $this->assertContains('flashes.config.notice.password_not_updated_demo', $client->getContainer()->get('session')->getFlashBag()->get('notice')[0]); |
606 | 606 | ||
607 | $config->set('demo_mode_enabled', 0); | 607 | $config->set('demo_mode_enabled', 0); |
608 | $config->set('demo_mode_username', 'wallabag'); | 608 | $config->set('demo_mode_username', 'wallabag'); |
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 | } |