Enable commands to upload and download translation file to/from crowdin. Setup ci workflow to automatically update translation files on each merge on main branch. Also add a worklow that can be manually triggered which is in charge to update application translation files then open a PR.
3.4 KiB
Internationalization (i18n)
Messages supports localization and internationalization on both backend and frontend:
- Backend: powered by Django i18n
- Frontend: powered by i18next, react-i18next, and i18next-cli
Development Workflow
Best practices during development
- Backend: always write strings in English using Django's translation utilities.
- Frontend: always write strings in English using
i18next.
👉 Translations are updated before each release.
- Backend strings are stored in:
src/backend/locale/{locale}/LC_MESSAGES/django.po - Frontend strings are stored in:
src/frontend/public/locales/{ns}/{locale}.json
Extraction and compilation of translations
The extraction and compilation process is automated by the CI pipeline:
-
Whenever the
mainbranch is updated, the CI will:- extract translations
- upload them to Crowdin
-
Whenever a branch with the prefix
release/is created, the CI will:- download and compile the updated translations
- create a pull request with the changes
Those processes can also be triggered manually.
Running the process locally
You can perform these steps locally using the Makefile.
⚠️ Make sure you have Crowdin environment variables configured in:
.env/development/crowdin
and that you have sufficient permissions on the Crowdin project.
- Extract and upload translations to Crowdin:
make i18n-generate-and-upload
- Download and compile translations:
make i18n-download-and-compile
Updating translations locally (not recommended)
It is possible (but discouraged) to manually edit translations locally:
-
Generate translation files:
make i18n-generate -
Edit missing translations directly in the generated files.
-
Generate translation files:
make i18n-compile -
Commit your changes.
⚠️ Warning: these local changes are likely to be overwritten by the next Crowdin update.
Contributing as a translator or proofreader
We use Crowdin to manage translations. It allows translators and proofreaders to contribute in the languages they know best.
👉 For more information, see the Crowdin documentation.
Adding a new language
If the language you need is not yet available:
- Click Request New Language on the project page.
- We will review and may add it.
⚠️ If you request a new language, you are expected to help keep it up to date whenever strings are added or modified --- especially before each release.
If your language already exists in a different variant (e.g. Brazilian Portuguese vs. European Portuguese), consider contributing to the existing one unless you have enough resources to maintain a separate variant.