Skip to content
This repository was archived by the owner on Oct 16, 2026. It is now read-only.

Commit ac65d03

Browse files
committed
Build MO files instead of versioning them
1 parent 0108658 commit ac65d03

5 files changed

Lines changed: 13 additions & 15 deletions

File tree

‎.gitignore‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
*.vimentry
22
.vimfiles.*
33
quick_gen_project_*_autogen.sh
4+
5+
# compiled translations, built by bin/console galette:compile-locales
6+
lang/*/LC_MESSAGES/*.mo

‎bin/release‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,15 @@ def add_libs(rel_name, galette_archive):
399399
galette.extractall(path=src_dir)
400400
galette.close()
401401

402+
# compile translations: MO files are not versioned
403+
lang_dir = os.path.join(src_dir, rel_name, 'lang')
404+
for pot in fnmatch.filter(os.listdir(lang_dir), '*.pot'):
405+
domain = pot[:-len('.pot')]
406+
for po in fnmatch.filter(os.listdir(lang_dir), '%s_*.po' % domain):
407+
mo_dir = os.path.join(lang_dir, po[len(domain) + 1:-len('.po')], 'LC_MESSAGES')
408+
os.makedirs(mo_dir, exist_ok=True)
409+
run('msgfmt --check -o "%s" "%s"' % (os.path.join(mo_dir, domain + '.mo'), os.path.join(lang_dir, po)))
410+
402411
plugin_dir = os.path.join(src_dir, rel_name)
403412

404413
# development only, nothing a Galette installation needs

‎lang/Makefile‎

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,21 +23,7 @@ po :
2323
done
2424

2525
mo :
26-
@echo "Generating MO files:"
27-
@for l in ${LANGUAGES}; do \
28-
for d in ${DOMAINS}; do \
29-
mkdir -p ${INSTALLDIR}/$${l}/LC_MESSAGES; \
30-
echo " formatting ${INSTALLDIR}/$${l}/LC_MESSAGES/$${d}.mo."; \
31-
msgfmt $${d}_$${l}.po -o ${INSTALLDIR}/$${l}/LC_MESSAGES/$${d}.mo.new; \
32-
if diff -qI 'PO-Revision-Date:.*' ${INSTALLDIR}/$${l}/LC_MESSAGES/$${d}.mo.new ${INSTALLDIR}/$${l}/LC_MESSAGES/$${d}.mo > /dev/null; then \
33-
echo " $${d}.mo NOT updated."; \
34-
rm ${INSTALLDIR}/$${l}/LC_MESSAGES/$${d}.mo.new; \
35-
else \
36-
echo " $${d}.mo UPDATED."; \
37-
mv ${INSTALLDIR}/$${l}/LC_MESSAGES/$${d}.mo.new ${INSTALLDIR}/$${l}/LC_MESSAGES/$${d}.mo; \
38-
fi; \
39-
done \
40-
done
26+
cd ../../../../ && bin/console galette:compile-locales plugin-fullcard
4127

4228
extract : ${PHP_SOURCES} Makefile
4329
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;

‎lang/en_US/LC_MESSAGES/fullcard.mo‎

-669 Bytes
Binary file not shown.
-756 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)