mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Update translation infrastructure
1. Build po/ipa.pot every time we update PO files (each build) 2. Drop any rebuilt PO changes if the only difference is in the translation file's header in a timestamp or timestamp+bug report link. 3. Only apply the logic for dropping the changes if we are operating on a git tree checkout because there is no otherwise an easy way to detect the changes. 4. Hook strip-po target to the cleanup target to allow dropping unneeded translation changes automatically. 5. Finally, strip ipaclient/remote_plugins/* locations from the ipa.pot template. This saves us around 23,000 lines from the ipa.pot file and reduces visual clutter in the translation files. This approach allows to avoid unneccesary commits because even when there are no changes to translation files, po/ipa.pot header would be updated with a new translation update timestamp. Fixes: https://pagure.io/freeipa/issue/8159 Signed-off-by: Alexander Bokovoy <abokovoy@redhat.com> Reviewed-By: Christian Heimes <cheimes@redhat.com>
This commit is contained in:
parent
92e36258ce
commit
b4722f3917
@ -7,32 +7,51 @@ DISTFILES.common.extra3 = Makefile.hack.in
|
||||
IPA_TEST_I18N = @top_srcdir@/ipatests/i18n.py
|
||||
MSGATTRIB = @MSGATTRIB@
|
||||
PYTHON = @PYTHON@
|
||||
GIT_BRANCH = @GIT_BRANCH@
|
||||
|
||||
.PHONY: strip-po
|
||||
strip-po:
|
||||
grep -v '#: ipaclient/remote_plugins/' $(DOMAIN).pot > $(DOMAIN).pot.tmp || exit 1; \
|
||||
mv $(DOMAIN).pot.tmp $(DOMAIN).pot || exit 1; \
|
||||
for po_file in $(POFILES); do \
|
||||
$(MSGATTRIB) --translated --no-fuzzy --no-location -s $$po_file > $$po_file.tmp || exit 1; \
|
||||
mv $$po_file.tmp $$po_file || exit 1; \
|
||||
if [ "$(GIT_BRANCH)" != "" ]; then \
|
||||
export GIT_DIFF_PO_FILE=`git diff --numstat $$po_file | cut -f1,2 | tr '\t' ,` || :; \
|
||||
if [ "$$GIT_DIFF_PO_FILE" = "2,2" -o "$$GIT_DIFF_PO_FILE" = "1,1" ]; then \
|
||||
echo "No translation changes in $$po_file, restore the original"; \
|
||||
git checkout -q -f $$po_file; \
|
||||
fi; \
|
||||
fi; \
|
||||
done
|
||||
if [ "$(GIT_BRANCH)" != "" ]; then \
|
||||
export GIT_DIFF_IPA_POT=`git diff --numstat $(DOMAIN).pot | cut -f1,2 | tr '\t' ,` || :; \
|
||||
if [ "$$GIT_DIFF_IPA_POT" = "2,2" -o "$$GIT_DIFF_IPA_POT" = "1,1" ]; then \
|
||||
echo "No changes in $(DOMAIN).pot, restore the original"; \
|
||||
git checkout -q -f $(DOMAIN).pot; \
|
||||
fi; \
|
||||
fi
|
||||
export FILES_TO_REMOVE=`find $(srcdir) -name '*.po' -empty` || exit 1; \
|
||||
if [ "$$FILES_TO_REMOVE" != "" ]; then \
|
||||
rm -v $$FILES_TO_REMOVE || exit 1; \
|
||||
echo; echo Please remove the deleted files from LINGUAS!; echo; \
|
||||
fi
|
||||
|
||||
clean: mostlyclean
|
||||
clean: strip-po mostlyclean
|
||||
rm -f *~
|
||||
|
||||
all: $(DOMAIN).pot strip-po
|
||||
|
||||
# linters
|
||||
test-gettext: $(DOMAIN).pot
|
||||
test-gettext: $(DOMAIN).pot strip-po
|
||||
$(PYTHON) $(IPA_TEST_I18N) --test-gettext
|
||||
|
||||
validate-pot: $(DOMAIN).pot
|
||||
validate-pot: $(DOMAIN).pot strip-po
|
||||
$(PYTHON) $(IPA_TEST_I18N) --show-strings --validate-pot $(DOMAIN).pot
|
||||
|
||||
validate-po: $(DOMAIN).pot
|
||||
validate-po: $(DOMAIN).pot strip-po
|
||||
$(PYTHON) $(IPA_TEST_I18N) --show-strings --validate-po $(POFILES)
|
||||
|
||||
# forcefully re-generate .pot file and test it
|
||||
validate-src-strings: $(DOMAIN).pot-update
|
||||
validate-src-strings: $(DOMAIN).pot-update strip-po
|
||||
$(MAKE) validate-pot
|
||||
|
@ -18,7 +18,7 @@ XGETTEXT_OPTIONS = --from-code="UTF-8" --keyword=_
|
||||
# or entity, or to disclaim their copyright. The empty string stands for
|
||||
# the public domain; in this case the translators are expected to disclaim
|
||||
# their copyright.
|
||||
COPYRIGHT_HOLDER = Red Hat
|
||||
COPYRIGHT_HOLDER = FreeIPA Contributors
|
||||
|
||||
# This tells whether or not to prepend "GNU " prefix to the package
|
||||
# name that gets inserted into the header of the $(DOMAIN).pot file.
|
||||
@ -41,7 +41,7 @@ PACKAGE_GNU = no
|
||||
# It can be your email address, or a mailing list address where translators
|
||||
# can write to without being subscribed, or the URL of a web page through
|
||||
# which the translators can contact you.
|
||||
MSGID_BUGS_ADDRESS = https://fedorahosted.org/freeipa/newticket
|
||||
MSGID_BUGS_ADDRESS = https://pagure.io/freeipa/new_issue
|
||||
|
||||
# This is the list of locale categories, beyond LC_MESSAGES, for which the
|
||||
# message catalogs shall be used. It is usually empty.
|
||||
|
Loading…
Reference in New Issue
Block a user