-
Notifications
You must be signed in to change notification settings - Fork 33
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
I18n refactor commands #408
base: master
Are you sure you want to change the base?
I18n refactor commands #408
Conversation
* Since Transifex is used to manage translations, all we have to provide is a .pot file as a source. This will be pushed to Transifex. * English is the default language, so this is generated on extraction. * When pulling from Transifex, .po files will be generated/updated. * On package release, all available language files (.po) are compiled into .json files. These are then used by the application for lookup.
6393075
to
7193e90
Compare
@@ -44,7 +10,7 @@ | |||
}, | |||
"scripts": { | |||
"extract_messages": "i18next-scanner --config i18next-scanner.config.js '../../js/**/*.{js,jsx}'", | |||
"postextract_messages": "i18next-conv -l en -s ./messages/en/translations.json -t ./translations.pot", | |||
"postextract_messages": "i18next-conv -l en -s ./messages/en/translations.json -t ./translations.pot && i18next-conv -l en -s ./messages/en/translations.json -t ./messages/en/messages.po", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will generate the .pot file for Transifex as well as the English .po file for the compilation process later.
|
||
# setup node | ||
- name: Setup node | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ env.NODE-VERSION }} | ||
|
||
- name: Install deps for frontend translations | ||
working-directory: ./invenio_requests/assets/semantic-ui/translations/invenio_requests | ||
# installing from package-lock.json | ||
run: | | ||
npm ci | ||
npm list | ||
|
||
# compile frontend messages | ||
- name: Compile frontend messages | ||
working-directory: ./invenio_requests/assets/semantic-ui/translations/invenio_requests | ||
run: | | ||
npm run compile_catalog | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It may make sense to move all of this to the reusable pypi publish workflow of inveniosoftware. More info can be found in the description of this PR.
❤️ Thank you for your contribution!
Description
This PR tackles i18n management for the UI. This is done to have the same workflow as the backend and be consistent throughout the package. Additionally, non-mandatory files are removed, manual work is reduced and the workflow should be easier to understand.
Most important files for these changes are
.js
files. Changes in.po
,.pot
and.json
files are for cleanup and providing the current extraction for English.It would make sense to move the adaptations of the publish workflow to the reusable workflows repository (https://github.com/inveniosoftware/workflows/blob/master/.github/workflows/pypi-publish.yml). This will require to provide the translations path as an input as is done here:
invenio-requests/.github/workflows/tests.yml
Lines 34 to 37 in 5cba3e0
Checklist
Ticks in all boxes and 🟢 on all GitHub actions status checks are required to merge:
Frontend
Reminder
By using GitHub, you have already agreed to the GitHub’s Terms of Service including that: