diff --git a/.github/workflows/ci-linux.yml b/.github/workflows/ci-linux.yml index 61a4dfa2..e7dba91b 100644 --- a/.github/workflows/ci-linux.yml +++ b/.github/workflows/ci-linux.yml @@ -184,6 +184,11 @@ jobs: with: path: galette-core/galette/plugins/plugin-auto + - name: Compile translations + run: | + cd galette-core + bin/console galette:compile-locales plugin-auto + - name: Init for PostgreSQL env: POSTGRES_HOST: localhost @@ -266,6 +271,11 @@ jobs: path: galette-core/galette/plugins/plugin-auto fetch-depth: 0 + - name: Compile translations + run: | + cd galette-core + bin/console galette:compile-locales plugin-auto + - name: Find previous release run: | cd galette-core/galette/plugins/plugin-auto diff --git a/.gitignore b/.gitignore index 55721b93..110ddf79 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,6 @@ quick_gen_project_* dist/ tempcache/ tests/coverage/ + +# compiled translations, built by bin/console galette:compile-locales +lang/*/LC_MESSAGES/*.mo diff --git a/bin/release b/bin/release index 2bab3d0d..3bcdd071 100755 --- a/bin/release +++ b/bin/release @@ -402,6 +402,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 4ff4a391..1106ccfc 100644 --- a/lang/Makefile +++ b/lang/Makefile @@ -25,21 +25,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-auto extract : twig ${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 auto.pot; diff --git a/lang/ar.utf8/LC_MESSAGES/auto.mo b/lang/ar.utf8/LC_MESSAGES/auto.mo deleted file mode 100644 index df34f483..00000000 Binary files a/lang/ar.utf8/LC_MESSAGES/auto.mo and /dev/null differ diff --git a/lang/br.utf8/LC_MESSAGES/auto.mo b/lang/br.utf8/LC_MESSAGES/auto.mo deleted file mode 100644 index 71d74e3f..00000000 Binary files a/lang/br.utf8/LC_MESSAGES/auto.mo and /dev/null differ diff --git a/lang/ca.utf8/LC_MESSAGES/auto.mo b/lang/ca.utf8/LC_MESSAGES/auto.mo deleted file mode 100644 index cc5346f0..00000000 Binary files a/lang/ca.utf8/LC_MESSAGES/auto.mo and /dev/null differ diff --git a/lang/de_DE.utf8/LC_MESSAGES/auto.mo b/lang/de_DE.utf8/LC_MESSAGES/auto.mo deleted file mode 100644 index cd0eae05..00000000 Binary files a/lang/de_DE.utf8/LC_MESSAGES/auto.mo and /dev/null differ diff --git a/lang/en_US/LC_MESSAGES/auto.mo b/lang/en_US/LC_MESSAGES/auto.mo deleted file mode 100644 index fbecf98e..00000000 Binary files a/lang/en_US/LC_MESSAGES/auto.mo and /dev/null differ diff --git a/lang/es.utf8/LC_MESSAGES/auto.mo b/lang/es.utf8/LC_MESSAGES/auto.mo deleted file mode 100644 index 65e19d5d..00000000 Binary files a/lang/es.utf8/LC_MESSAGES/auto.mo and /dev/null differ diff --git a/lang/fr_FR.utf8/LC_MESSAGES/auto.mo b/lang/fr_FR.utf8/LC_MESSAGES/auto.mo deleted file mode 100644 index 9da2594d..00000000 Binary files a/lang/fr_FR.utf8/LC_MESSAGES/auto.mo and /dev/null differ diff --git a/lang/it_IT.utf8/LC_MESSAGES/auto.mo b/lang/it_IT.utf8/LC_MESSAGES/auto.mo deleted file mode 100644 index 2163b047..00000000 Binary files a/lang/it_IT.utf8/LC_MESSAGES/auto.mo and /dev/null differ diff --git a/lang/nb_NO.utf8/LC_MESSAGES/auto.mo b/lang/nb_NO.utf8/LC_MESSAGES/auto.mo deleted file mode 100644 index ce3ea27d..00000000 Binary files a/lang/nb_NO.utf8/LC_MESSAGES/auto.mo and /dev/null differ diff --git a/lang/oc.utf8/LC_MESSAGES/auto.mo b/lang/oc.utf8/LC_MESSAGES/auto.mo deleted file mode 100644 index 7333b442..00000000 Binary files a/lang/oc.utf8/LC_MESSAGES/auto.mo and /dev/null differ diff --git a/lang/ota.utf8/LC_MESSAGES/auto.mo b/lang/ota.utf8/LC_MESSAGES/auto.mo deleted file mode 100644 index 5c9ed9d2..00000000 Binary files a/lang/ota.utf8/LC_MESSAGES/auto.mo and /dev/null differ diff --git a/lang/pt.utf8/LC_MESSAGES/auto.mo b/lang/pt.utf8/LC_MESSAGES/auto.mo deleted file mode 100644 index fe4af12d..00000000 Binary files a/lang/pt.utf8/LC_MESSAGES/auto.mo and /dev/null differ diff --git a/lang/pt_BR.utf8/LC_MESSAGES/auto.mo b/lang/pt_BR.utf8/LC_MESSAGES/auto.mo deleted file mode 100644 index 5d07396c..00000000 Binary files a/lang/pt_BR.utf8/LC_MESSAGES/auto.mo and /dev/null differ diff --git a/lang/ru.utf8/LC_MESSAGES/auto.mo b/lang/ru.utf8/LC_MESSAGES/auto.mo deleted file mode 100644 index 88230c85..00000000 Binary files a/lang/ru.utf8/LC_MESSAGES/auto.mo and /dev/null differ diff --git a/lang/si.utf8/LC_MESSAGES/auto.mo b/lang/si.utf8/LC_MESSAGES/auto.mo deleted file mode 100644 index 66b90145..00000000 Binary files a/lang/si.utf8/LC_MESSAGES/auto.mo and /dev/null differ diff --git a/lang/sl.utf8/LC_MESSAGES/auto.mo b/lang/sl.utf8/LC_MESSAGES/auto.mo deleted file mode 100644 index a541acc6..00000000 Binary files a/lang/sl.utf8/LC_MESSAGES/auto.mo and /dev/null differ diff --git a/lang/sl/LC_MESSAGES/auto.mo b/lang/sl/LC_MESSAGES/auto.mo deleted file mode 100644 index 6c0826fd..00000000 Binary files a/lang/sl/LC_MESSAGES/auto.mo and /dev/null differ diff --git a/lang/ta.utf8/LC_MESSAGES/auto.mo b/lang/ta.utf8/LC_MESSAGES/auto.mo deleted file mode 100644 index 856e7142..00000000 Binary files a/lang/ta.utf8/LC_MESSAGES/auto.mo and /dev/null differ diff --git a/lang/tr.utf8/LC_MESSAGES/auto.mo b/lang/tr.utf8/LC_MESSAGES/auto.mo deleted file mode 100644 index 4481e834..00000000 Binary files a/lang/tr.utf8/LC_MESSAGES/auto.mo and /dev/null differ diff --git a/lang/uk.utf8/LC_MESSAGES/auto.mo b/lang/uk.utf8/LC_MESSAGES/auto.mo deleted file mode 100644 index 45aae36c..00000000 Binary files a/lang/uk.utf8/LC_MESSAGES/auto.mo and /dev/null differ