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
This commit is contained in:
Daniel Uber 2021-10-20 13:50:22 -04:00 committed by GitHub
parent cdb823bdf9
commit f5a65c5f0c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 1 deletions

View file

@ -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

View file

@ -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.

View file

@ -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: "<strong>Vidéo est en bêta:</strong> %{contact}"
upload: "🎥 Télécharger un fichier vidéo 🙌"