Opened 4 years ago

Closed 4 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:


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 4 years ago by borja

i18n support added here: changeset:d411dae/OpenWorkouts-current, changeset:fd6da93/OpenWorkouts-current

spanish (es) translations and script helpers added here: changeset:a4e4799/OpenWorkouts-current

comment:2 Changed 4 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:


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:


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).

  1. 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/ ow/locale/de/LC_MESSAGES/OpenWorkouts.po" >> bin/update_translations
  2. create the translations directory for that lang:

    mkdir -p ow/locale/de/LC_MESSAGES
  3. create the .po file for the first time for that lang:

    msginit -l de -o ow/locale/de/LC_MESSAGES/OpenWorkouts.po
  4. translate! by editing the .po file and doing the translations

  5. run the script to generate the .mo file:


After that, whenever there are new translations, follow the steps described above (After adding new texts to be translated)

comment:3 Changed 4 years ago by borja

  • Resolution set to fixed
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.