diff --git a/Makefile.PL b/Makefile.PL index 1c5c8423d..2f45a6257 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -56,10 +56,10 @@ sub MY::postamble { # Make FreeBSD use gmake for share/Makefile $text = 'GMAKE ?= "gmake"' . "\n" . 'pure_all :: share/Makefile' . "\n" - . "\t" . 'cd share && $(GMAKE) touch-po all' . "\n"; + . "\t" . 'cd share && $(GMAKE) all' . "\n"; } else { $text = 'pure_all :: share/Makefile' . "\n" - . "\t" . 'cd share && $(MAKE) touch-po all' . "\n"; + . "\t" . 'cd share && $(MAKE) all' . "\n"; }; return $text; }; diff --git a/docs/Translation-translators.md b/docs/Translation-translators.md index d18efa25d..8e4fe0f10 100644 --- a/docs/Translation-translators.md +++ b/docs/Translation-translators.md @@ -63,7 +63,8 @@ Currently there are the following files (and languages): * nb.po (Norwegian) * sv.po (Swedish) -Execute `make xx.po` to update the *PO* file for language "xx". +Execute `./update-po xx.po` to update the *PO* file for language +"xx". Choose the language code for the language that you want to update. The command will update the *PO* file with new message ids (*msgid*) from the source code. @@ -78,8 +79,8 @@ ids based on fuzzy matching of similar strings. This is not always desirable and you can disable fuzzy matching by executing one of the following commands instead: ``` -make xx.po MSGMERGE_OPTS=--no-fuzzy-mathing -make update-po MSGMERGE_OPTS=--no-fuzzy-mathing +make update-po MSGMERGE_OPTS=--no-fuzzy-matching POFILES=xx.po +make update-po MSGMERGE_OPTS=--no-fuzzy-matching ``` ## Github preparation @@ -167,7 +168,7 @@ welcome comments on these. language code in question. This should be done every time. ``` cd share - make xx.po + ./update-po xx.po ``` * The *PO* file is updated with new *msgids*, if any, and now you can start @@ -272,7 +273,7 @@ steps before this step: > to work with. Replace "xx" with the language code in question. > ``` > cd share - > make xx.po + > ./update-po xx.po > ``` The new language is not there and cannot be updated. Instead you have to @@ -293,7 +294,7 @@ of an existing file. for Swedish. ``` cd share - make sv.po + ./update-po sv.po cp sv.po xx.po git checkout sv.po ``` diff --git a/share/GNUmakefile b/share/GNUmakefile index a86bbbefc..74b7e0a4c 100644 --- a/share/GNUmakefile +++ b/share/GNUmakefile @@ -1,6 +1,6 @@ .POSIX: .SUFFIXES: .po .mo -.PHONY: all check-msg-args dist extract-pot tidy-po show-fuzzy touch-po update-po +.PHONY: all check-msg-args dist extract-pot tidy-po show-fuzzy update-po POFILES := $(shell find . -maxdepth 1 -type f -name '*.po' -exec basename {} \;) MOFILES := $(POFILES:%.po=%.mo) @@ -20,19 +20,14 @@ tidy-po: trap 'rm -rf "$$tmpdir"' EXIT ;\ for f in $(POFILES) ; do msgcat $$f -o $$tmpdir/$$f && mv -f $$tmpdir/$$f $$f ; done -touch-po: - @touch $(POTFILE) $(POFILES) - -update-po: extract-pot $(POFILES) +update-po: extract-pot + @for f in $(POFILES) ; do msgmerge --update --backup=none --quiet --no-location $(MSGMERGE_OPTS) $$f $(POTFILE) ; done extract-pot: @xgettext --output $(POTFILE) --sort-by-file --add-comments --language=Perl --from-code=UTF-8 -k__ -k\$$__ -k%__ -k__x -k__n:1,2 -k__nx:1,2 -k__xn:1,2 -kN__ -kN__n:1,2 -k__p:1c,2 -k__np:1c,2,3 -kN__p:1c,2 -kN__np:1c,2,3 $(PMFILES) $(POTFILE): extract-pot -$(POFILES): $(POTFILE) - @msgmerge --update --backup=none --quiet --no-location $(MSGMERGE_OPTS) $@ $(POTFILE) - .po.mo: @msgfmt -o $@ $< @mkdir -p locale/`basename $@ .mo`/LC_MESSAGES diff --git a/share/update-po b/share/update-po new file mode 100755 index 000000000..32027655d --- /dev/null +++ b/share/update-po @@ -0,0 +1,9 @@ +#!/bin/sh + +if [ -z "$1" ] ; then + echo "error: No PO file specified." >&2 + exit 2 +fi +po_file="$1" ; shift + +make update-po POFILES="$po_file"