summaryrefslogtreecommitdiffstats
path: root/install/po/Makefile.in
diff options
context:
space:
mode:
authorPetr Viktorin <pviktori@redhat.com>2012-06-20 06:38:16 -0400
committerRob Crittenden <rcritten@redhat.com>2012-07-24 16:54:21 -0400
commit23e188f2260f60e05cc7c33b029440db2253a170 (patch)
tree9ca3f6babeccbba8c19b1346c6ed6a54f13fbaad /install/po/Makefile.in
parentcc42d19e35ee54b9fcf82e70b7897a6d386d08b9 (diff)
downloadfreeipa-23e188f2260f60e05cc7c33b029440db2253a170.tar.gz
freeipa-23e188f2260f60e05cc7c33b029440db2253a170.tar.xz
freeipa-23e188f2260f60e05cc7c33b029440db2253a170.zip
Arrange stripping .po files
The .po files we use for translations have two shortcomings when used in Git: - They include file locations, which change each time the source is updated. This results in large, unreadable diffs that don't merge well. - They include source strings for untranslated messages, wasting space unnecessarily. Update the Makefile so that the extraneous information is stripped when the files are updated or pulled form Transifex, and empty translation files are removed entirely. Also, translations are normalized to a common style. This should help diffs and merges. The validator requires file location comments to identify the programming language, and to produce good error reports. To make this work, merge the comments in before validation. First patch for: https://fedorahosted.org/freeipa/ticket/2435
Diffstat (limited to 'install/po/Makefile.in')
-rw-r--r--install/po/Makefile.in22
1 files changed, 20 insertions, 2 deletions
diff --git a/install/po/Makefile.in b/install/po/Makefile.in
index 9a3dde78a..bc91a933b 100644
--- a/install/po/Makefile.in
+++ b/install/po/Makefile.in
@@ -14,6 +14,7 @@ MSGFMT = @MSGFMT@
MSGINIT = @MSGINIT@
MSGMERGE = @MSGMERGE@
MSGCMP = @MSGCMP@
+MSGATTRIB = @MSGATTRIB@
TX = @TX@
IPA_TEST_I18N = ../../tests/i18n.py
@@ -67,7 +68,7 @@ C_POTFILES = $(C_FILES) $(H_FILES)
.SUFFIXES:
.SUFFIXES: .po .mo
-.PHONY: all create-po update-po update-pot install mostlyclean clean distclean test mo-files debug
+.PHONY: all create-po update-po update-pot install mostlyclean clean distclean test mo-files debug strip-po merge-po $(po_files)
all:
@@ -86,6 +87,19 @@ $(po_files): $(DOMAIN).pot
echo Merging $(DOMAIN).pot into $@; \
$(MSGMERGE) --no-fuzzy-matching -o $@ $@ $(DOMAIN).pot
+strip-po:
+ @for po_file in $(po_files); do \
+ echo Stripping $$po_file; \
+ $(MSGATTRIB) --translated --no-fuzzy --no-location $$po_file > $$po_file.tmp; \
+ mv $$po_file.tmp $$po_file; \
+ done
+ @export FILES_TO_REMOVE=`find . -name '*.po' -empty`; \
+ if [ "$$FILES_TO_REMOVE" != "" ]; then \
+ echo Removing empty translation files; \
+ rm -v $$FILES_TO_REMOVE; \
+ echo; echo Please remove the deleted files from LINGUAS!; echo; \
+ fi
+
create-po: $(DOMAIN).pot
@for po_file in $(po_files); do \
if [ ! -e $$po_file ]; then \
@@ -98,10 +112,14 @@ create-po: $(DOMAIN).pot
pull-po:
cd ../..; $(TX) pull -f
+ $(MAKE) strip-po
-update-po: update-pot
+merge-po: update-pot
$(MAKE) $(po_files)
+update-po: merge-po
+ $(MAKE) strip-po
+
update-pot:
@rm -f $(DOMAIN).pot.update
@pushd ../.. ; \