Opened 5 years ago
Closed 5 years ago
#56 closed task (fixed)
i18n scripts, helpers and docs
Reported by: | borja | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | OpenWorkouts 0.2 |
Component: | internals | Keywords: | |
Cc: |
Description
Add some scripts to make translators' lives a bit easier. All strings should be marked for translation now, but even so let's do a test-run of the usual pyramid internationalization machinery and see if anything is missing too.
Change History (3)
comment:1 Changed 5 years ago by borja
comment:2 Changed 5 years ago by borja
Instructions for i18n
After adding new texts to be translated
Once you have new translation strings in the app, from the root of the repo, with the virtual environment active, run:
./bin/new_translations
This will inspect the source code, extract translation strings and update the source:OpenWorkouts-current/ow/locale/OpenWorkouts.pot file. Then it will merge the new strings into the existing .po files for the available translations (currently only es)
Then open the po files (like source:OpenWorkouts-current/ow/locale/es/LC_MESSAGES/OpenWorkouts.po) in your favourite editor and translate whatever is missing.
After editing the po file, run:
./bin/update_translations
to generate the mo file.
Adding a new lang/locale
For example, let's say we want to add de (please replace de with the code for whatever language you want to add, like fr, dk, pt, etc).
edit the helper scripts and add the proper lines to create the directory needed for that lang:
echo "msgmerge --update ow/locale/de/LC_MESSAGES/OpenWorkouts.po ow/locale/OpenWorkouts.pot" >> bin/new_translations echo "msgfmt --statistics -o ow/locale/de/LC_MESSAGES/OpenWorkouts.mo ow/locale/de/LC_MESSAGES/OpenWorkouts.po" >> bin/update_translations
create the translations directory for that lang:
mkdir -p ow/locale/de/LC_MESSAGES
create the .po file for the first time for that lang:
msginit -l de -o ow/locale/de/LC_MESSAGES/OpenWorkouts.po
translate! by editing the .po file and doing the translations
run the script to generate the .mo file:
./bin/update_translations
After that, whenever there are new translations, follow the steps described above (After adding new texts to be translated)
comment:3 Changed 5 years ago by borja
- Resolution set to fixed
- Status changed from new to closed
i18n support added here: changeset:d411dae/OpenWorkouts-current, changeset:fd6da93/OpenWorkouts-current
spanish (es) translations and script helpers added here: changeset:a4e4799/OpenWorkouts-current