Skip to content
This repository has been archived by the owner on Feb 8, 2018. It is now read-only.

Use transifex for i18n #2831

Merged
merged 10 commits into from
Oct 28, 2014
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ docs/_build
docs/gratipay
docs/gratipay.rst
_vimrc_local.vim
.transifexrc
8 changes: 8 additions & 0 deletions .tx/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[main]
host = https://www.transifex.com

[gratipay-com.core]
source_file = i18n/core.pot
source_lang = en
file_filter = i18n/core/<lang>.po
type = PO
23 changes: 19 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,22 @@ node_modules: package.json
jstest: node_modules
./node_modules/.bin/grunt test

i18n_update: env
$(env_bin)/pybabel extract -F .babel_extract --no-wrap --omit-header -o i18n/tmp.pot templates www
for f in i18n/*.po; do $(env_bin)/pybabel update -i i18n/tmp.pot -l $$(basename $${f%.*}) --no-fuzzy-matching -o $$f; done
rm i18n/tmp.pot
transifexrc:
@echo '[https://www.transifex.com]' >.transifexrc
@echo 'hostname = https://www.transifex.com' >>.transifexrc
@echo "password = $$TRANSIFEX_PASS" >>.transifexrc
@echo 'token = ' >>.transifexrc
@echo "username = $$TRANSIFEX_USER" >>.transifexrc

tx:
@if [ ! -x $(env_bin)/tx ]; then $(env_bin)/pip install transifex-client; fi

i18n_upload: env tx
$(env_bin)/pybabel extract -F .babel_extract --no-wrap -o i18n/core.pot templates www
$(env_bin)/tx push -s
rm i18n/*.pot

i18n_download: env tx
$(env_bin)/tx pull -a -f --mode=reviewed --minimum-perc=50
sed -r -e '/^"POT?-[^-]+-Date: /d' -i i18n/*/*.po
sed -e '/^#: /d' -i i18n/*/*.po
2 changes: 1 addition & 1 deletion gratipay/utils/i18n.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def load_langs(localeDir):


# Load the locales
LOCALES = load_langs("i18n")
LOCALES = load_langs("i18n/core")

# Add the default English locale
LOCALE_EN = LOCALES['en'] = Locale('en')
Expand Down
3 changes: 3 additions & 0 deletions i18n/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
The files in this directory are not meant to be modified by Pull Requests. If
you want to contribute to the internationalization of Gratipay please join our
translation teams on Transifex: https://www.transifex.com/projects/p/gratipay-com/
Loading