From f5a65c5f0ce1588e49c83aecb6b2f7d962e80f26 Mon Sep 17 00:00:00 2001 From: Daniel Uber Date: Wed, 20 Oct 2021 13:50:22 -0400 Subject: [PATCH] Update i18n read_path to match our current localization file layout (#15140) * Update read path to match our current file layout The files specified under "more files" were expecting to be named *.{locale}.yml, like misc.en.yml or tags.fr.yml. However, our project layout is using a directory prefix like misc/en.yml or tags/fr.yml. Consequently, the locale files for views were not being tested (a previous update ensured that they were being loaded). Change the load pattern to match the files we use in the app, and ensure they're tested. This introduces test failures which will be addressed in the next commit. * Add back the original pattern This matches files like devise.en.yml and other existing files in config/locales (not already in a subdirectory). * Update inconsistent interpolation The english version had `{community}` while the french version had `{name}` for the videos.heading key, checking the call site at https://github.com/forem/forem/blob/main/app/views/videos/index.html.erb#L26 we have `community:`, passed for interpolation to the translate call, so change the french translations to include that, rather than name * Update missing pluralization for badges * make travis happy --- config/i18n-tasks.yml | 1 + config/locales/views/misc/en.yml | 1 + config/locales/views/misc/fr.yml | 3 ++- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/config/i18n-tasks.yml b/config/i18n-tasks.yml index d5e1e5538..8997d61d8 100644 --- a/config/i18n-tasks.yml +++ b/config/i18n-tasks.yml @@ -19,6 +19,7 @@ data: - config/locales/%{locale}.yml ## More files: - config/locales/**/*.%{locale}.yml + - config/locales/**/%{locale}.yml # Locale files to write new keys to, based on a list of key pattern => file rules. Matched from top to bottom: # `i18n-tasks normalize -p` will force move the keys according to these rules diff --git a/config/locales/views/misc/en.yml b/config/locales/views/misc/en.yml index 1c016d134..0b6001178 100644 --- a/config/locales/views/misc/en.yml +++ b/config/locales/views/misc/en.yml @@ -6,6 +6,7 @@ en: title: Badges name: "%{title} Badge" all: + one: Show one badge other: Show all %{count} badges heading: Badges desc: Receive badges for being awesome! Click on a badge to see how you can earn it. diff --git a/config/locales/views/misc/fr.yml b/config/locales/views/misc/fr.yml index 276132ffb..a8ac171e2 100644 --- a/config/locales/views/misc/fr.yml +++ b/config/locales/views/misc/fr.yml @@ -6,6 +6,7 @@ fr: title: Badges name: "%{title} Badge" all: + one: Show one badge other: Show all %{count} badges heading: Badges desc: Receive badges for being awesome! Click on a badge to see how you can earn it. @@ -67,6 +68,6 @@ fr: title: Videos og: description: All videos on %{community} - heading: "%{name} en Vidéo" + heading: "%{community} en Vidéo" beta_html: "Vidéo est en bêta: %{contact}" upload: "🎥 Télécharger un fichier vidéo 🙌"