diff --git a/.gitignore b/.gitignore index a8db417..6dfc75f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ *.vimentry .vimfiles.* quick_gen_project_*_autogen.sh + +# compiled translations, built by bin/console galette:compile-locales +lang/*/LC_MESSAGES/*.mo diff --git a/bin/release b/bin/release index 7298c9f..68d0459 100755 --- a/bin/release +++ b/bin/release @@ -399,6 +399,15 @@ def add_libs(rel_name, galette_archive): galette.extractall(path=src_dir) galette.close() + # compile translations: MO files are not versioned + lang_dir = os.path.join(src_dir, rel_name, 'lang') + for pot in fnmatch.filter(os.listdir(lang_dir), '*.pot'): + domain = pot[:-len('.pot')] + for po in fnmatch.filter(os.listdir(lang_dir), '%s_*.po' % domain): + mo_dir = os.path.join(lang_dir, po[len(domain) + 1:-len('.po')], 'LC_MESSAGES') + os.makedirs(mo_dir, exist_ok=True) + run('msgfmt --check -o "%s" "%s"' % (os.path.join(mo_dir, domain + '.mo'), os.path.join(lang_dir, po))) + plugin_dir = os.path.join(src_dir, rel_name) # development only, nothing a Galette installation needs diff --git a/lang/Makefile b/lang/Makefile index 9d8a4a9..95f0a42 100644 --- a/lang/Makefile +++ b/lang/Makefile @@ -23,21 +23,7 @@ po : done mo : - @echo "Generating MO files:" - @for l in ${LANGUAGES}; do \ - for d in ${DOMAINS}; do \ - mkdir -p ${INSTALLDIR}/$${l}/LC_MESSAGES; \ - echo " formatting ${INSTALLDIR}/$${l}/LC_MESSAGES/$${d}.mo."; \ - msgfmt $${d}_$${l}.po -o ${INSTALLDIR}/$${l}/LC_MESSAGES/$${d}.mo.new; \ - if diff -qI 'PO-Revision-Date:.*' ${INSTALLDIR}/$${l}/LC_MESSAGES/$${d}.mo.new ${INSTALLDIR}/$${l}/LC_MESSAGES/$${d}.mo > /dev/null; then \ - echo " $${d}.mo NOT updated."; \ - rm ${INSTALLDIR}/$${l}/LC_MESSAGES/$${d}.mo.new; \ - else \ - echo " $${d}.mo UPDATED."; \ - mv ${INSTALLDIR}/$${l}/LC_MESSAGES/$${d}.mo.new ${INSTALLDIR}/$${l}/LC_MESSAGES/$${d}.mo; \ - fi; \ - done \ - done + cd ../../../../ && bin/console galette:compile-locales plugin-fullcard extract : ${PHP_SOURCES} Makefile xgettext ${PHP_SOURCES} --keyword=_T:1,2t --keyword=__:1,2t --keyword=_Tn:1,2,4t --keyword=_Tx:1c,2,3t --keyword=_Tnx:1c,2,3,5t -L PHP --from-code=UTF-8 --add-comments=TRANS --force-po -o fullcard.pot; diff --git a/lang/en_US/LC_MESSAGES/fullcard.mo b/lang/en_US/LC_MESSAGES/fullcard.mo deleted file mode 100644 index 5187954..0000000 Binary files a/lang/en_US/LC_MESSAGES/fullcard.mo and /dev/null differ diff --git a/lang/fr_FR.utf8/LC_MESSAGES/fullcard.mo b/lang/fr_FR.utf8/LC_MESSAGES/fullcard.mo deleted file mode 100644 index e549141..0000000 Binary files a/lang/fr_FR.utf8/LC_MESSAGES/fullcard.mo and /dev/null differ