Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create a cron job to update the locale files used by the CI #534

Open
1 task
obulat opened this issue Jul 26, 2022 · 0 comments
Open
1 task

Create a cron job to update the locale files used by the CI #534

obulat opened this issue Jul 26, 2022 · 0 comments
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

Comments

@obulat
Copy link
Contributor

obulat commented Jul 26, 2022

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:

  • run pnpm build that would generate the JSON files in the src/locales folder.
  • copy src/locales/scripts/valid-locales.json to test/locales/scripts
  • detect the 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)
    • remove the deleted strings from test/locales/es.json, test/locales/ru.json, and test/locales/ar.json
    • add the translated versions of the new strings from en.json to test/locales/es.json, test/locales/ru.json, and test/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.
    • manually set the translated percentage of ru locale in test/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 translating en.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

  • 🙋 I would be interested in implementing this feature.
@obulat obulat added 🟩 priority: low Low priority and doesn't need to be rushed ✨ goal: improvement Improvement to an existing user-facing feature 🤖 aspect: dx Concerns developers' experience with the codebase labels Jul 26, 2022
@obulat obulat transferred this issue from WordPress/openverse-frontend Feb 22, 2023
@obulat obulat added the 🧱 stack: frontend Related to the Nuxt frontend label Feb 22, 2023
@github-project-automation github-project-automation bot moved this to 📋 Backlog in Openverse Backlog Feb 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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
Projects
Status: 📋 Backlog
Development

No branches or pull requests

1 participant