2.6 KiB
Translation
POEditor
Baby Buddy uses POEditor for translation contributions. Interested contributors can join translation of Baby Buddy for access to a simple, web-based frontend for adding/editing translation files to the project.
Manual
Baby Buddy has support for translation/localization. A manual translation process will look something like this:
-
Set up a development environment (see Development environment).
-
Run
gulp makemessages -l xx
wherexx
is a specific locale code in the ISO 639-1 format (e.g., "il" for Italian or "es" for Spanish). This creates a new translation file atlocale/xx/LC_MESSAGES/django.po
, or updates one if it exists. -
Open the created/updated
django.po
file and update the header template with license and contact info. -
Start translating! Each translatable string will have a
msgid
value with the string in English and a corresponding (empty)msgstr
value where a translated string can be filled in. -
Once all strings have been translated, run
gulp compilemessages -l xx
to compile an optimized translation file (locale/xx/LC_MESSAGES/django.mo
). -
To expose the new translation as a user setting, add the locale code to the
LANGUAGES
array in the base settings file (babybuddy/settings/base.py
). -
Check if Plotly offers a translation (in
node_modules/plotly.js/dist/
) for the language. If it does:-
Add the Plotly translation file path to
gulpfile.config.js
inscriptsConfig.graph
. -
Build, collect, and commit the
/static
folder (seegulp updatestatic
).
-
-
Check if Moment offers a translation (in
node_modules/moment/locale/
) for the language. If it does:-
Add the Moment translation file path to
gulpfile.config.js
inscriptsConfig.vendor
. -
Build, collect, and commit the
/static
folder (seegulp updatestatic
).
-
-
Run the development server, log in, and update the user language to test the newly translated strings.
Once the translation is complete, commit the new files and changes to a fork and create a pull request for review.
For more information on the Django translation process, see Django's documentation section: Translation.