diff --git a/.github/workflows/ci-linux.yml b/.github/workflows/ci-linux.yml index e92fcd9..8e50a34 100644 --- a/.github/workflows/ci-linux.yml +++ b/.github/workflows/ci-linux.yml @@ -187,6 +187,11 @@ jobs: with: path: galette-core/galette/plugins/plugin-stripe + - name: Compile translations + run: | + cd galette-core + bin/console galette:compile-locales plugin-stripe + - name: Install dependencies run: | cd galette-core/galette/plugins/plugin-stripe diff --git a/.gitignore b/.gitignore index 528c594..250e280 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,6 @@ dist/ tempcache/ lang/*.po~ vendor/ + +# compiled translations, built by bin/console galette:compile-locales +lang/*/LC_MESSAGES/*.mo diff --git a/bin/release b/bin/release index 375057c..ff3ac9d 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))) + build_dir = os.path.join(src_dir, rel_name) shutil.rmtree(os.path.join(build_dir, '.github')) diff --git a/lang/Makefile b/lang/Makefile index 531e470..2a8d527 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-stripe 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 ${DOMAINS}.pot; diff --git a/lang/ar.utf8/LC_MESSAGES/stripe.mo b/lang/ar.utf8/LC_MESSAGES/stripe.mo deleted file mode 100644 index 7e65eff..0000000 Binary files a/lang/ar.utf8/LC_MESSAGES/stripe.mo and /dev/null differ diff --git a/lang/br.utf8/LC_MESSAGES/stripe.mo b/lang/br.utf8/LC_MESSAGES/stripe.mo deleted file mode 100644 index e94a75f..0000000 Binary files a/lang/br.utf8/LC_MESSAGES/stripe.mo and /dev/null differ diff --git a/lang/ca.utf8/LC_MESSAGES/stripe.mo b/lang/ca.utf8/LC_MESSAGES/stripe.mo deleted file mode 100644 index 85df6fd..0000000 Binary files a/lang/ca.utf8/LC_MESSAGES/stripe.mo and /dev/null differ diff --git a/lang/de_DE.utf8/LC_MESSAGES/stripe.mo b/lang/de_DE.utf8/LC_MESSAGES/stripe.mo deleted file mode 100644 index a8d2f75..0000000 Binary files a/lang/de_DE.utf8/LC_MESSAGES/stripe.mo and /dev/null differ diff --git a/lang/en_US/LC_MESSAGES/stripe.mo b/lang/en_US/LC_MESSAGES/stripe.mo deleted file mode 100644 index c706cd7..0000000 Binary files a/lang/en_US/LC_MESSAGES/stripe.mo and /dev/null differ diff --git a/lang/es.utf8/LC_MESSAGES/stripe.mo b/lang/es.utf8/LC_MESSAGES/stripe.mo deleted file mode 100644 index d2b5486..0000000 Binary files a/lang/es.utf8/LC_MESSAGES/stripe.mo and /dev/null differ diff --git a/lang/fr_FR.utf8/LC_MESSAGES/stripe.mo b/lang/fr_FR.utf8/LC_MESSAGES/stripe.mo deleted file mode 100644 index 38854b8..0000000 Binary files a/lang/fr_FR.utf8/LC_MESSAGES/stripe.mo and /dev/null differ diff --git a/lang/it_IT.utf8/LC_MESSAGES/stripe.mo b/lang/it_IT.utf8/LC_MESSAGES/stripe.mo deleted file mode 100644 index de2a667..0000000 Binary files a/lang/it_IT.utf8/LC_MESSAGES/stripe.mo and /dev/null differ diff --git a/lang/nb_NO.utf8/LC_MESSAGES/stripe.mo b/lang/nb_NO.utf8/LC_MESSAGES/stripe.mo deleted file mode 100644 index c25e5c2..0000000 Binary files a/lang/nb_NO.utf8/LC_MESSAGES/stripe.mo and /dev/null differ diff --git a/lang/oc.utf8/LC_MESSAGES/stripe.mo b/lang/oc.utf8/LC_MESSAGES/stripe.mo deleted file mode 100644 index ab6f2f2..0000000 Binary files a/lang/oc.utf8/LC_MESSAGES/stripe.mo and /dev/null differ diff --git a/lang/ota.utf8/LC_MESSAGES/stripe.mo b/lang/ota.utf8/LC_MESSAGES/stripe.mo deleted file mode 100644 index 4081855..0000000 Binary files a/lang/ota.utf8/LC_MESSAGES/stripe.mo and /dev/null differ diff --git a/lang/pt.utf8/LC_MESSAGES/stripe.mo b/lang/pt.utf8/LC_MESSAGES/stripe.mo deleted file mode 100644 index 8bb1695..0000000 Binary files a/lang/pt.utf8/LC_MESSAGES/stripe.mo and /dev/null differ diff --git a/lang/pt_BR.utf8/LC_MESSAGES/stripe.mo b/lang/pt_BR.utf8/LC_MESSAGES/stripe.mo deleted file mode 100644 index 01f39ab..0000000 Binary files a/lang/pt_BR.utf8/LC_MESSAGES/stripe.mo and /dev/null differ diff --git a/lang/ru.utf8/LC_MESSAGES/stripe.mo b/lang/ru.utf8/LC_MESSAGES/stripe.mo deleted file mode 100644 index e8d6fa8..0000000 Binary files a/lang/ru.utf8/LC_MESSAGES/stripe.mo and /dev/null differ diff --git a/lang/si.utf8/LC_MESSAGES/stripe.mo b/lang/si.utf8/LC_MESSAGES/stripe.mo deleted file mode 100644 index 96602ee..0000000 Binary files a/lang/si.utf8/LC_MESSAGES/stripe.mo and /dev/null differ diff --git a/lang/sl.utf8/LC_MESSAGES/stripe.mo b/lang/sl.utf8/LC_MESSAGES/stripe.mo deleted file mode 100644 index a672663..0000000 Binary files a/lang/sl.utf8/LC_MESSAGES/stripe.mo and /dev/null differ diff --git a/lang/ta.utf8/LC_MESSAGES/stripe.mo b/lang/ta.utf8/LC_MESSAGES/stripe.mo deleted file mode 100644 index 41eedd8..0000000 Binary files a/lang/ta.utf8/LC_MESSAGES/stripe.mo and /dev/null differ diff --git a/lang/tr.utf8/LC_MESSAGES/stripe.mo b/lang/tr.utf8/LC_MESSAGES/stripe.mo deleted file mode 100644 index 747fc14..0000000 Binary files a/lang/tr.utf8/LC_MESSAGES/stripe.mo and /dev/null differ diff --git a/lang/uk.utf8/LC_MESSAGES/stripe.mo b/lang/uk.utf8/LC_MESSAGES/stripe.mo deleted file mode 100644 index 3a27707..0000000 Binary files a/lang/uk.utf8/LC_MESSAGES/stripe.mo and /dev/null differ