Create a cron job to update the locale files used by the CI #534
Labels
🤖 aspect: dx
Concerns developers' experience with the codebase
✨ goal: improvement
Improvement to an existing user-facing feature
🟩 priority: low
Low priority and doesn't need to be rushed
🧱 stack: frontend
Related to the Nuxt frontend
Problem
The locale files such as the list of all locales and the translation strings for each locale are created on each app build. This is important to keep the translated strings up-to-date in production. However, every CI run also updates the locales and makes a lot of network requests. To minimize the number of network calls made by the CI, WordPress/openverse-frontend#1575 saves the select locale files to the
test/locales
. Now though the locale files used by the CI are not updated at all.Description
We should create a Cron job that would automatically update the locale files in
test/locales
. It could be done monthly.Steps:
pnpm build
that would generate theJSON
files in thesrc/locales
folder.src/locales/scripts/valid-locales.json
totest/locales/scripts
en.json
strings that were removed or added since the last time we saved the locale files (we need to find a good solution for how to do this)test/locales/es.json
,test/locales/ru.json
, andtest/locales/ar.json
en.json
totest/locales/es.json
,test/locales/ru.json
, andtest/locales/ar.json
- this step will require the Google or Amazon translation requests. We could also start by simply adding blank strings for the new keys and logging the list of strings that we need to translate to add them manually - for a start.ru
locale intest/locales/scripts/valid-locales.json
to a number lower than 90% (if it is higher) so that it can be used for testing the translation banner.Alternatives
We could manually copy the files generated in the build step monthly. The problem is that the
ar.json
file was manually generated by translatingen.json
strings with Google Translate, so it would break the 100% translated status of the Arabic locale and fail many RTL tests.Additional context
More discussion on the rationale for the way locales work in the CI is in WordPress/openverse-frontend#1575 and its comments.
Implementation
The text was updated successfully, but these errors were encountered: