From b5380b7a8940010773315988a9fe4009bea86edc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9ctor=20Franco?= Date: Sun, 22 Nov 2026 10:44:19 +0100 Subject: [PATCH] test(i18n): reject Spanish left in other locales; translate es/fr/it/nl/pt gaps --- docs/CHANGELOG.md | 4 + .../translations/NowoTaskBoardBundle.es.yaml | 2 +- .../translations/NowoTaskBoardBundle.fr.yaml | 2 +- .../translations/NowoTaskBoardBundle.it.yaml | 4 +- .../translations/NowoTaskBoardBundle.nl.yaml | 2 +- .../translations/NowoTaskBoardBundle.pt.yaml | 2 +- .../Translation/TranslationCatalogueTest.php | 100 ++++++++++++++++-- 7 files changed, 104 insertions(+), 12 deletions(-) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index e88fb8df..4b2fffdc 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -129,6 +129,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Fixed + +- Translations: `task_board.list.title` is now "Liste" (fr), `task_board.task.links` is now "Koppelingen" (nl) and "Link" (it), `task_board.member.stakeholder` is now "Parte interesada" (es) and "Parte interessata" (it), and `task_board.recurrence.skipped` is now "Ignorada: %date%" (pt, it was the Spanish "Saltada"). `TranslationCatalogueTest` also fails now on a non-es value identical to the Spanish one (longer than 12 characters) unless allow-listed per locale as genuinely shared, and on stale entries of that allow-list. + ## [2.30.0] - 2026-11-22 ### Changed diff --git a/src/Resources/translations/NowoTaskBoardBundle.es.yaml b/src/Resources/translations/NowoTaskBoardBundle.es.yaml index 16cc55fd..a075d329 100644 --- a/src/Resources/translations/NowoTaskBoardBundle.es.yaml +++ b/src/Resources/translations/NowoTaskBoardBundle.es.yaml @@ -86,7 +86,7 @@ task_board.link.documentation: Documentación task_board.link.other: Otro task_board.member.assignee: Responsable task_board.member.reviewer: Revisor -task_board.member.stakeholder: Stakeholder +task_board.member.stakeholder: Parte interesada task_board.member.watcher: Observador task_board.time.estimate: Estimación task_board.time.logged: Registrado diff --git a/src/Resources/translations/NowoTaskBoardBundle.fr.yaml b/src/Resources/translations/NowoTaskBoardBundle.fr.yaml index 03b20d00..03dd985f 100644 --- a/src/Resources/translations/NowoTaskBoardBundle.fr.yaml +++ b/src/Resources/translations/NowoTaskBoardBundle.fr.yaml @@ -4,7 +4,7 @@ nav: task_board.index.title: "Tableaux de tâches" task_board.index.subtitle: "Organisez le travail avec des tableaux kanban, des listes et le détail des tâches." task_board.board.title: "Tableau" -task_board.list.title: List +task_board.list.title: Liste task_board.task.title: "Tâche" task_board.index.create_board: "Créer un tableau" task_board.index.your_boards: "Vos tableaux" diff --git a/src/Resources/translations/NowoTaskBoardBundle.it.yaml b/src/Resources/translations/NowoTaskBoardBundle.it.yaml index f41209b4..d1a59231 100644 --- a/src/Resources/translations/NowoTaskBoardBundle.it.yaml +++ b/src/Resources/translations/NowoTaskBoardBundle.it.yaml @@ -61,7 +61,7 @@ task_board.flash.task_moved_next: "Attività spostata nella colonna successiva." task_board.flash.task_moved_done: "Attività contrassegnata come completata." task_board.task.subtasks: "Sottoattività" task_board.task.no_subtasks: "Nessuna sottoattività." -task_board.task.links: Links +task_board.task.links: Link task_board.task.no_links: "Nessun link per ora." task_board.task.dependencies: "Dipendenze" task_board.task.no_dependencies: "Nessuna dipendenza." @@ -86,7 +86,7 @@ task_board.link.documentation: "Documentazione" task_board.link.other: "Altro" task_board.member.assignee: "Assegnatario" task_board.member.reviewer: "Revisore" -task_board.member.stakeholder: Stakeholder +task_board.member.stakeholder: Parte interessata task_board.member.watcher: "Osservatore" task_board.time.estimate: "Stima" task_board.time.logged: "Registrato" diff --git a/src/Resources/translations/NowoTaskBoardBundle.nl.yaml b/src/Resources/translations/NowoTaskBoardBundle.nl.yaml index eb064c73..db4f9275 100644 --- a/src/Resources/translations/NowoTaskBoardBundle.nl.yaml +++ b/src/Resources/translations/NowoTaskBoardBundle.nl.yaml @@ -61,7 +61,7 @@ task_board.flash.task_moved_next: "Taak verplaatst naar de volgende kolom." task_board.flash.task_moved_done: "Taak gemarkeerd als voltooid." task_board.task.subtasks: "Subtaken" task_board.task.no_subtasks: "Geen subtaken." -task_board.task.links: Links +task_board.task.links: Koppelingen task_board.task.no_links: "Nog geen links." task_board.task.dependencies: "Afhankelijkheden" task_board.task.no_dependencies: "Geen afhankelijkheden." diff --git a/src/Resources/translations/NowoTaskBoardBundle.pt.yaml b/src/Resources/translations/NowoTaskBoardBundle.pt.yaml index d1ec3c41..910f82a2 100644 --- a/src/Resources/translations/NowoTaskBoardBundle.pt.yaml +++ b/src/Resources/translations/NowoTaskBoardBundle.pt.yaml @@ -821,7 +821,7 @@ task_board.recurrence.reason.plan: "bloqueada pelos limites do plano; volta a te task_board.recurrence.skip: "Saltar" task_board.recurrence.skip_next: "Saltar a seguinte" task_board.recurrence.skip_next_set: "A seguinte é saltada" -task_board.recurrence.skipped: "Saltada: %date%" +task_board.recurrence.skipped: "Ignorada: %date%" task_board.recurrence.unskip: "Anular salto" task_board.recurrence.pause: "Pausar" task_board.recurrence.resume: "Retomar" diff --git a/tests/Unit/Translation/TranslationCatalogueTest.php b/tests/Unit/Translation/TranslationCatalogueTest.php index a59cb7a3..ea7c90b0 100644 --- a/tests/Unit/Translation/TranslationCatalogueTest.php +++ b/tests/Unit/Translation/TranslationCatalogueTest.php @@ -15,6 +15,7 @@ use function glob; use function in_array; use function is_array; +use function mb_strlen; use function preg_match; use function preg_replace; use function sort; @@ -23,7 +24,8 @@ /** * Guards against untranslated strings: in every non-en catalogue (all domains) a key must exist, and a value identical to * the English one (any length, ignoring values without letters once placeholders are removed) must be listed in - * ALLOWED_IDENTICAL for that locale. An allow-list entry that is no longer identical to English is reported as stale. + * ALLOWED_IDENTICAL for that locale. A non-es value identical to the Spanish one (longer than 12 characters, not English) + * must be listed in ALLOWED_SAME_AS_SPANISH. An allow-list entry that no longer applies is reported as stale. */ final class TranslationCatalogueTest extends TestCase { @@ -87,7 +89,6 @@ final class TranslationCatalogueTest extends TestCase 'task_board.link.issue', 'task_board.link.pull_request', 'task_board.link.url', - 'task_board.member.stakeholder', 'task_board.multi.export.no', 'task_board.priority.normal', 'task_board.sync.details.minutes', @@ -114,7 +115,6 @@ final class TranslationCatalogueTest extends TestCase 'task_board.link.merge_request', 'task_board.link.pull_request', 'task_board.link.url', - 'task_board.list.title', 'task_board.menu.column', 'task_board.question.form.option', 'task_board.question.form.options', @@ -154,7 +154,6 @@ final class TranslationCatalogueTest extends TestCase 'task_board.link.merge_request', 'task_board.link.pull_request', 'task_board.link.url', - 'task_board.member.stakeholder', 'task_board.multi.export.no', 'task_board.sync.connect.provider', 'task_board.sync.details.minutes', @@ -162,7 +161,6 @@ final class TranslationCatalogueTest extends TestCase 'task_board.sync.provider.clickup', 'task_board.sync.provider.unknown', 'task_board.sync.trigger.console', - 'task_board.task.links', ], 'nl' => [ 'nav.brand', @@ -210,7 +208,6 @@ final class TranslationCatalogueTest extends TestCase 'task_board.sync.provider.clickup', 'task_board.sync.provider.unknown', 'task_board.sync.trigger.console', - 'task_board.task.links', 'task_board.task.status', 'task_board.task.workflow', ], @@ -238,6 +235,40 @@ final class TranslationCatalogueTest extends TestCase ], ]; + /** + * Keys whose non-es value legitimately equals the Spanish one (longer than 12 characters, different from English): + * words and phrases that are genuinely the same in Spanish and the locale, per locale. + * + * @var array> + */ + private const ALLOWED_SAME_AS_SPANISH = [ + 'it' => [ + 'task_board.copy.copy_title', + 'task_board.import.help.col_priority', + ], + 'pt' => [ + 'task_board.board.show_less', + 'task_board.calendar.sr_moved', + 'task_board.dependency.relation.blocked_by', + 'task_board.dependency.relation.duplicated_by', + 'task_board.index.open_gantt', + 'task_board.index.open_list', + 'task_board.index.views_of', + 'task_board.list.sort_title', + 'task_board.list.total_shown', + 'task_board.menu.flash.timer_started', + 'task_board.menu.timer', + 'task_board.multi.export.xlsx', + 'task_board.number.copy_named', + 'task_board.question.answered_by', + 'task_board.question.form.context_help', + 'task_board.question.mine.to_answer', + 'task_board.question.withdrawn_by', + 'task_board.recurrence.next', + 'task_board.sync.fields.rating', + ], + ]; + /** @return iterable */ public static function catalogues(): iterable { @@ -280,6 +311,36 @@ public function testNoUntranslatedEnglishValues(string $domain, string $locale): self::assertSame([], $gaps, sprintf('Values identical to English in %s.%s.yaml (translate or allow-list)', $domain, $locale)); } + /** @return iterable */ + public static function nonSpanishCatalogues(): iterable + { + foreach (self::catalogues() as $name => [$domain, $locale]) { + if ($locale !== 'es') { + yield $name => [$domain, $locale]; + } + } + } + + #[DataProvider('nonSpanishCatalogues')] + public function testNoSpanishLeftInOtherLocales(string $domain, string $locale): void + { + $english = $this->load($domain, 'en'); + $spanish = $this->load($domain, 'es'); + $target = $this->load($domain, $locale); + $allowed = self::ALLOWED_SAME_AS_SPANISH[$locale] ?? []; + $leaks = []; + + foreach ($spanish as $key => $value) { + if (!isset($target[$key]) || $target[$key] !== $value || $value === ($english[$key] ?? null) || mb_strlen($value) <= 12 || in_array($key, $allowed, true)) { + continue; + } + + $leaks[] = $key; + } + + self::assertSame([], $leaks, sprintf('Values identical to Spanish in %s.%s.yaml (translate or allow-list)', $domain, $locale)); + } + public function testAllowListHasNoStaleEntries(): void { $english = []; @@ -303,6 +364,33 @@ public function testAllowListHasNoStaleEntries(): void self::assertSame([], $stale, 'Allow-list entries that no longer exist or are no longer identical to English'); } + public function testSpanishAllowListHasNoStaleEntries(): void + { + $english = []; + $spanish = []; + $locales = []; + + foreach (self::catalogues() as [$domain, $locale]) { + $english += $this->load($domain, 'en'); + $spanish += $this->load($domain, 'es'); + $locales[$locale] = ($locales[$locale] ?? []) + $this->load($domain, $locale); + } + + $stale = []; + + foreach (self::ALLOWED_SAME_AS_SPANISH as $locale => $keys) { + foreach ($keys as $key) { + $value = $spanish[$key] ?? null; + + if ($value === null || ($locales[$locale][$key] ?? null) !== $value || $value === ($english[$key] ?? null) || mb_strlen($value) <= 12) { + $stale[] = $locale . ':' . $key; + } + } + } + + self::assertSame([], $stale, 'Spanish allow-list entries that no longer exist or no longer equal the Spanish value'); + } + /** @return array */ private function load(string $domain, string $locale): array {