Skip to content

Generate theme translations

Liz Conlan edited this page Jun 14, 2019 · 5 revisions

Setup

Add a .tx/config

[main]
file_filter = locale-theme/<lang>/app.po
host = https://www.transifex.com

[asktheeu-theme.apppot]
file_filter = locale-theme/<lang>/app.po
source_lang = en
source_file = locale-theme/app.pot
type = PO

Generate the source .pot

# From the main alaveteli directory
bundle exec rake gettext:find_theme THEME=asktheeu-theme

Manually add THEME_DIR/locale-theme/app.pot to the theme's Transifex project

Add the source file

Manually add the available translation languages to the theme's Transifex project

Add theme languages

Pull, clean and re-push the translations

# From the theme directory
tx pull -f -a
# For some reason the --all flag (-a) doesn't pull the .po
# for the source language
tx pull -f -l en

# From the main alaveteli directory
bundle exec rake gettext:clean_theme THEME=asktheeu-theme

# From the theme directory
tx push -s -t

Updates

Pull any updates, clean and re-push the translations

# From the theme directory
tx pull -f -a
# For some reason the --all flag (-a) doesn't pull the .po
# for the source language
tx pull -f -l en

# From the main alaveteli directory
bundle exec rake gettext:clean_theme THEME=asktheeu-theme

Check the translations for XSS insertion

Check as far as possible for mistakes which may break translations (missing variables, wrong variable names, broken HTML tags)

# From the theme directory
git commit locale-theme -m 'Update translations'

# From the main alaveteli directory
bundle exec rake gettext:find_theme THEME=asktheeu-theme

# From the theme directory
tx push -s -t
tx pull -f -a
tx pull -f -l en

# From the main alaveteli directory
bundle exec rake gettext:clean_theme THEME=asktheeu-theme

You may need to manually remove obsolete msgids.

find locale-theme/* -name *.po | xargs -I % msgattrib --no-obsolete -o % %

Commit the new translations:

# From the theme directory
git commit locale-theme -m 'Generate translations'
Clone this wiki locally