From e93675e03639c2c8d4fc7d70cfccaa10f5f1707e Mon Sep 17 00:00:00 2001 From: Alexis Degrugillier Date: Mon, 28 Dec 2020 07:08:38 -0500 Subject: Fix tag management translation (#3292) Before, feedback messages were not translated. Now, they are. --- app/Controllers/tagController.php | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'app/Controllers') diff --git a/app/Controllers/tagController.php b/app/Controllers/tagController.php index 75f276d19..217d95db1 100644 --- a/app/Controllers/tagController.php +++ b/app/Controllers/tagController.php @@ -92,10 +92,10 @@ class FreshRSS_tag_Controller extends Minz_ActionController { $tagDAO = FreshRSS_Factory::createTagDao(); if (null === $tagDAO->searchByName($name)) { $tagDAO->addTag(['name' => $name]); - Minz_Request::good('feedback.tag.created', ['c' => 'tag', 'a' => 'index'], true); + Minz_Request::good(_t('feedback.tag.created', $name), ['c' => 'tag', 'a' => 'index'], true); } - Minz_Request::bad('feedback.tag.name_exists', ['c' => 'tag', 'a' => 'index'], true); + Minz_Request::bad(_t('feedback.tag.name_exists', $name), ['c' => 'tag', 'a' => 'index'], true); } public function renameAction() { @@ -103,17 +103,21 @@ class FreshRSS_tag_Controller extends Minz_ActionController { Minz_Error::error(405); } - $name = Minz_Request::param('name'); + $targetName = Minz_Request::param('name'); + $sourceId = Minz_Request::param('id_tag'); + $tagDAO = FreshRSS_Factory::createTagDao(); - $newTag = $tagDAO->searchByName($name); - if (null === $newTag) { - $tagDAO->updateTag(Minz_Request::param('id_tag'), ['name' => $name]); + + $sourceName = $tagDAO->searchById($sourceId)->name(); + $targetTag = $tagDAO->searchByName($targetName); + if (null === $targetTag) { + $tagDAO->updateTag($sourceId, ['name' => $targetName]); } else { - $tagDAO->updateEntryTag(Minz_Request::param('id_tag'), $newTag->id()); - $tagDAO->deleteTag(Minz_Request::param('id_tag')); + $tagDAO->updateEntryTag($sourceId, $targetTag->id()); + $tagDAO->deleteTag($sourceId); } - Minz_Request::good('feedback.tag.renamed', ['c' => 'tag', 'a' => 'index'], true); + Minz_Request::good(_t('feedback.tag.renamed', $sourceName, $targetName), ['c' => 'tag', 'a' => 'index'], true); } public function indexAction() { -- cgit v1.2.3