[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
trans-coord/gnun/server/gnun AUTHORS ChangeLog ...
From: |
Pavel Kharitonov |
Subject: |
trans-coord/gnun/server/gnun AUTHORS ChangeLog ... |
Date: |
Sat, 17 Mar 2012 15:00:48 +0000 |
CVSROOT: /sources/trans-coord
Module name: trans-coord
Changes by: Pavel Kharitonov <ineiev> 12/03/17 15:00:46
Modified files:
gnun/server/gnun: AUTHORS ChangeLog GNUmakefile Makefile.am NEWS
config.mk config.mk.in configure.ac
gnun/server/gnun/doc: gnun.texi
Added files:
gnun/server/gnun: copy-msgid copy-msgid.in
Log message:
Introduce compendia.
* copy-msgid.in: New file.
* GNUmakefile (compendium-rules, find-language, check-new-po):
New functions.
(compendia, compendia/compendium.pot): New targets.
(COPY-MSGID, COMMONALITY): New variables.
(all): Add `compendia' as the first prerequisite.
(update-po): Use compendia, `find-language' and `check-new-po'.
Add third argument (language code). Decide about applying
`ADD-FUZZY-DIFF' in make rather than in command line. Rewrite
first part of update as a single pipeline; join the commands
with `&&'.
(generate-html, extra-template-lang-rules, template-rules)
(article-rules, home-rules, $(template-dir)/po/whatsnew.%.html):
Use new `update-po' invocation.
(generate-html): Use make variables instead of shell parameters.
(template-rules, extra-template-lang-rules, home-rules)
(article-rules): Use new `generate-html' invocation.
($(template-dir)/po/whatsnew.%.html): Use `find-language'.
Refactor conditionals.
(home-rules, article-rules, report): Use `find-language'.
* config.mk.in (MSGATTRIB, MSGCAT): New variables.
* configure.ac: Detect `msgcat'.
* Makefile.am: Add `copy-msgid'.
* doc/gnun.texi (Compendia): New node.
* NEWS: Update.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/trans-coord/gnun/server/gnun/AUTHORS?cvsroot=trans-coord&r1=1.7&r2=1.8
http://cvs.savannah.gnu.org/viewcvs/trans-coord/gnun/server/gnun/ChangeLog?cvsroot=trans-coord&r1=1.259&r2=1.260
http://cvs.savannah.gnu.org/viewcvs/trans-coord/gnun/server/gnun/GNUmakefile?cvsroot=trans-coord&r1=1.117&r2=1.118
http://cvs.savannah.gnu.org/viewcvs/trans-coord/gnun/server/gnun/Makefile.am?cvsroot=trans-coord&r1=1.25&r2=1.26
http://cvs.savannah.gnu.org/viewcvs/trans-coord/gnun/server/gnun/NEWS?cvsroot=trans-coord&r1=1.47&r2=1.48
http://cvs.savannah.gnu.org/viewcvs/trans-coord/gnun/server/gnun/config.mk?cvsroot=trans-coord&r1=1.8&r2=1.9
http://cvs.savannah.gnu.org/viewcvs/trans-coord/gnun/server/gnun/config.mk.in?cvsroot=trans-coord&r1=1.8&r2=1.9
http://cvs.savannah.gnu.org/viewcvs/trans-coord/gnun/server/gnun/configure.ac?cvsroot=trans-coord&r1=1.33&r2=1.34
http://cvs.savannah.gnu.org/viewcvs/trans-coord/gnun/server/gnun/copy-msgid?cvsroot=trans-coord&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/trans-coord/gnun/server/gnun/copy-msgid.in?cvsroot=trans-coord&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/trans-coord/gnun/server/gnun/doc/gnun.texi?cvsroot=trans-coord&r1=1.49&r2=1.50
Patches:
Index: AUTHORS
===================================================================
RCS file: /sources/trans-coord/trans-coord/gnun/server/gnun/AUTHORS,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- AUTHORS 25 Nov 2011 08:10:27 -0000 1.7
+++ AUTHORS 17 Mar 2012 15:00:21 -0000 1.8
@@ -5,8 +5,9 @@
Pavel Kharitonov <address@hidden>
- Add add-fuzzy-diff.in, diff-page-head.html, diff-page-tail.html,
- dtd/html5.dtd (based on W3C DTD), expand-m4-includes.in,
+ Add add-fuzzy-diff.in, copy-msgid.in, diff-page-head.html,
+ diff-page-tail.html, dtd/html5.dtd (based on W3C DTD),
+ expand-m4-includes.in,
languages.txt (compiled from www.gnu.org pages),
gnun-add-fuzzy-diff, translinks-head.html, translinks-tail.html,
update-localized-urls.in.
Index: ChangeLog
===================================================================
RCS file: /sources/trans-coord/trans-coord/gnun/server/gnun/ChangeLog,v
retrieving revision 1.259
retrieving revision 1.260
diff -u -b -r1.259 -r1.260
--- ChangeLog 16 Mar 2012 11:48:13 -0000 1.259
+++ ChangeLog 17 Mar 2012 15:00:22 -0000 1.260
@@ -1,3 +1,33 @@
+2012-03-17 Pavel Kharitonov <address@hidden>
+
+ Introduce compendia.
+
+ * copy-msgid.in: New file.
+ * GNUmakefile (compendium-rules, find-language, check-new-po):
+ New functions.
+ (compendia, compendia/compendium.pot): New targets.
+ (COPY-MSGID, COMMONALITY): New variables.
+ (all): Add `compendia' as the first prerequisite.
+ (update-po): Use compendia, `find-language' and `check-new-po'.
+ Add third argument (language code). Decide about applying
+ `ADD-FUZZY-DIFF' in make rather than in command line. Rewrite
+ first part of update as a single pipeline; join the commands
+ with `&&'.
+ (generate-html, extra-template-lang-rules, template-rules)
+ (article-rules, home-rules, $(template-dir)/po/whatsnew.%.html):
+ Use new `update-po' invocation.
+ (generate-html): Use make variables instead of shell parameters.
+ (template-rules, extra-template-lang-rules, home-rules)
+ (article-rules): Use new `generate-html' invocation.
+ ($(template-dir)/po/whatsnew.%.html): Use `find-language'.
+ Refactor conditionals.
+ (home-rules, article-rules, report): Use `find-language'.
+ * config.mk.in (MSGATTRIB, MSGCAT): New variables.
+ * configure.ac: Detect `msgcat'.
+ * Makefile.am: Add `copy-msgid'.
+ * doc/gnun.texi (Compendia): New node.
+ * NEWS: Update.
+
2012-03-16 Pavel Kharitonov <address@hidden>
* GNUmakefile (reports-summary): New target.
Index: GNUmakefile
===================================================================
RCS file: /sources/trans-coord/trans-coord/gnun/server/gnun/GNUmakefile,v
retrieving revision 1.117
retrieving revision 1.118
diff -u -b -r1.117 -r1.118
--- GNUmakefile 16 Mar 2012 11:48:13 -0000 1.117
+++ GNUmakefile 17 Mar 2012 15:00:22 -0000 1.118
@@ -32,6 +32,7 @@
MAKE-PROTOTYPE := $(pkglibexecdir)/make-prototype
UPDATE-LOCALIZED-URLS := $(pkglibexecdir)/update-localized-urls
ADD-FUZZY-DIFF := $(pkglibexecdir)/add-fuzzy-diff
+COPY-MSGID := $(pkglibexecdir)/copy-msgid
PO4A-GETTEXTIZEFLAGS := -o porefs=none
PO4A-TRANSLATEFLAGS := --keep=0
@@ -42,6 +43,9 @@
-o "untranslated=W<gnun> W<script>" \
-o "translated=W<pre>"
+# The lower limit of the number of repeating msgids to include in compendium.
+COMMONALITY := 10
+
# Default period to delay notice about translation being out of date
ifdef GRACE
OUTDATED-GRACE := 60
@@ -156,7 +160,7 @@
### End of variables declaration (`no-grace' items) ###
### Special variables for all other articles ###
-# FIXME: Variables' computatation could be optimized, but in any event
+# FIXME: Variables' computation could be optimized, but in any event
# it is much better if translators do not have to add manually anything.
articles := $(foreach dir,$(ALL_DIRS),$(addprefix $(dir)/po/,$(value $(dir))))
articles-pot := $(addprefix $(rootdir)/,$(articles:%=%.pot))
@@ -178,8 +182,9 @@
ifeq ($(_have-Makefile),yes)
include Makefile
else
-all: $(template-pots) $(template-translated) $(gnunews) $(home-translated) \
- $(ALL_POTS) $(staged-originals) $(articles-translated) final-stage
+all: compendia $(template-pots) $(template-translated) $(gnunews) \
+ $(home-translated) $(ALL_POTS) $(staged-originals) \
+ $(articles-translated) final-stage
endif
no-grace-items: $(template-pots) $(template-translated) \
$(home-translated) $(staged-originals) \
@@ -249,6 +254,136 @@
$(call add-file,$@)
endef
+# Check whether the changes in the PO file are not trivial;
+# update the PO when needed and remove the temporary file.
+# It is assumed that the old file is $(1), and the new one is $(1).tmp.
+define check-new-po
+if ([ ! -f $(1) ] || [ "`diff -U 0 $(1) $(1).tmp \
+ | $(GREP) -v "^\(---\|+++\|@@\)" \
+ | $(GREP) -v '^[-+]"\(POT-Creation-Date\|PO-Revision-Date\|Language\):' \
+ | wc -c`" -ne 0 ]); then \
+ mv $(1).tmp $(1) ; \
+else \
+ $(RM) $(1).tmp; \
+fi
+endef
+
+### Declarations for compendia ###
+#
+# All files specifically processed here shall live in compendia/.
+# The manually maintained files are:
+#
+## exclude.pot
+#
+# Strings that shouldn't go to compendia, like GNUN slots.
+#
+## master.${lang}.po
+#
+# Translations that should be used when the specified msgid appears in
+# an article; in other words, this file overrides the translations from
+# other files. Other PO files will be rebuilt whenever this file
+# changes.
+#
+# The generated files are:
+#
+## compendium.pot
+#
+# Compiled from all POT files; a msgid is included when it appears
+# more than $(COMMONALITY) times.
+#
+## compendium.${lang}.po
+#
+# Translations of strings from compendium.pot collected
+# from all ${lang} PO files.
+#
+# This file can be used by the human editor to update master.${lang}.po.
+#
+## fuzzified-compendium.${lang}.po
+#
+# Translations from compendium.${lang}.po marked fuzzy even if they
+# are not, "previous" msgid is added when absent.
+#
+# This file is used as a source for missing msgstrs when merging
+# the translations; it is not kept in CVS.
+#
+## master-translated.${lang}.po
+#
+# Translated current messages from master.${lang}.po.
+#
+# This file is used to actually update the translations in ${lang};
+# it is not kept in CVS.
+
+# Target to rebuild compendia.
+.PHONY: compendia
+
+compendia: $(foreach lang,$(TEMPLATE_LINGUAS), \
+ compendia/fuzzified-compendium.$(lang).po)
+
+compendia/compendium.pot: $(template-pots) $(ALL_POTS)
+ $(addfile)
+# The `--use-first' option is needed to avoid stacked "translations"
+# of the header (msgid="").
+ $(MSGCAT) --use-first --more-than=$(COMMONALITY) -o address@hidden $^
+# msgcat produces an error when handling files with Charset "CHARSET"
+# unless all files have .pot extention, so we can't just use .tmp.
+ $(MSGCAT) --use-first --less-than=3 -o address@hidden address@hidden \
+ compendia/exclude.pot
+ $(MSGCAT) --use-first --unique -o address@hidden address@hidden \
+ compendia/exclude.pot
+ mv address@hidden address@hidden
+ $(call check-new-po,$@)
+
+define compendium-rules
+ALL_$(1)_POS := \
+ $(shell ls -t $(filter %.$(1).po,$(ALL_POS) $(template-pots:.pot=.$(1).po)))
+
+MASTER-$(1) :=
+MASTER-$(1)-OPTION :=
+
+# Define rules for compendia if there are any translations.
+ifneq ($$(ALL_$(1)_POS),)
+
+ifeq ($$(shell test -s compendia/master.$(1).po && echo yes),yes)
+
+# Extract current translations from master compendium.
+compendia/master-translated.$(1).po: compendia/master.$(1).po
+ $(MSGATTRIB) --no-fuzzy --translated -o $$@ $$<
+
+MASTER-$(1) := compendia/master-translated.$(1).po
+MASTER-$(1)-OPTION := -C $$(MASTER-$(1))
+
+endif # eq ($$(shell test -s compendia/master.$(1).po && echo yes),yes)
+
+compendia/compendium.$(1).po: compendia/compendium.pot $$(ALL_$(1)_POS)
+ $(MSGCAT) --use-first -o address@hidden $$(ALL_$(1)_POS)
+ addfile=no; prev_comp=$$@; \
+ test -s $$@ || { addfile=yes; prev_comp=/dev/null; } ; \
+ if test -s address@hidden; then \
+ $(MSGMERGE) --previous -C address@hidden -o address@hidden $$$${prev_comp}
$$<; \
+ fi \
+ && $(RM) address@hidden \
+ && if test -s address@hidden; then \
+ test $$$${addfile} = no || $$(addfile); \
+ $(call check-new-po,$$@); \
+ else \
+ $(RM) address@hidden; \
+ fi
+
+compendia/fuzzified-compendium.$(1).po: compendia/compendium.$(1).po
+ $(MSGATTRIB) --translated --clear-obsolete --set-fuzzy $$< \
+ | $(COPY-MSGID) > $$@
+
+COMPENDIUM-$(1)-OPTION := \
+ $$(shell test -s compendia/fuzzified-compendium.$(1).po \
+ && echo -C compendia/fuzzified-compendium.$(1).po)
+
+endif # ifneq ($$(ALL_$(1)_POS),)
+endef # compendium-rules
+
+$(foreach lang,$(TEMPLATE_LINGUAS),$(eval $(call compendium-rules,$(lang))))
+
+### End declarations for compendia ###
+
# Compile translations list
define generate-translinks
$(call add-file,$(1).translist); \
@@ -297,28 +432,25 @@
"[GNUN Error] POT generation of $(subst $(rootdir)/,,$@) failed" \
$(PO4A_GETTEXTIZE) $(PO4A-XHTMLFLAGS) $(PO4A-GETTEXTIZEFLAGS) \
--master $< --po address@hidden
-if ([ ! -f $@ ] || [ "`diff -U 0 $@ address@hidden | $(GREP) -v
"^\(---\|+++\|@@\)" \
- | $(GREP) -v '^[-+]\"POT-Creation-Date:' | wc -c`" -ne 0 ]); then \
- mv address@hidden $@ ; \
-fi;
+$(call check-new-po,$@)
touch $@
-$(RM) address@hidden
endef
-# The command to generate the translated article OUT in HTML format
-# from a PO file. The result is further manipulated in the recipes.
+# The command to generate the translated article $(3) in language $(1)
+# in HTML format from a PO file $(2). The result is further manipulated
+# in the recipes.
#
# If a translator commits a PO file based on an old version of the
# POT, it is not msgmerge'd as `make' considers the corresponding
-# `$(1).po' target up-to-date. As a result, the generated HTML
-# translations has English strings (but no fuzzy strings in the PO)
+# $(2) target up-to-date. As a result, the generated HTML
+# translations have English strings (but no fuzzy strings in the PO)
# since there's no match between msgid/msgstr. Invoke update-po
# unconditionally to cope with that (valid) scenario.
define generate-html
-$(call update-po,$$$$PO,$$$${PO%$(1).po}pot); \
+$(call update-po,$(2),$(2:.$(1).po=.pot),$(1)); \
$(PO4A_TRANSLATE) $(PO4A-XHTMLFLAGS) $(PO4A-TRANSLATEFLAGS) \
- --master $$< --po $$$$PO --localized $$$$OUT; \
- $(call substitute-localized-includes,$(1)) $$$$OUT
+ --master $$< --po $(2) --localized $(3); \
+ $(call substitute-localized-includes,$(1)) $(3)
endef
comma := ,
@@ -420,27 +552,42 @@
fi
endef
+# Check whether language code $(1) is present in list $(2)
+# It assumes that language codes can't contain `.';
+# it takes into account possibility of partial matches like
+# `br' vs. `pt-br'.
+define find-language
+$(findstring .$(1).,$(addsuffix .,$(addprefix .,$(2))))
+endef
+
# The command to update a PO file ($(1)) from the POT ($(2)).
+# $(3) is the language code.
#
# The target is `touched' in order to make `make' to consider it
# up-to-date even if there is nothing to merge. The default values of
# Content-Type and Content-Transfer-Encoding are replaced with commonly
-# used values.
+# used values. When appropriate, $(ADD-FUZZY-DIFF) is invoked.
+#
+# When compendia/master-translated.$(3).po present, its translations override
+# the translations from $(1); when compendia/fuzzy-compendium.$(3).po is
+# present, it is checked for missing translations.
define update-po
-$(SED) --in-place \
+$(SED) \
'1,/^$$$$/ { \
address@hidden("Content-Type: text/plain;
charset\)=CHARSET\\n"@\1=UTF-8\\n"@; \
s/^\("Content-Transfer-Encoding:\) ENCODING\\n"/\1 8bit\\n"/; \
- }' $(1); \
-$(MSGMERGE) --update --previous $(1) $(2) && touch $(1) \
+ }' $(1) \
+ $(if $(MASTER-$(3)), \
+ | $(MSGATTRIB) --clear-obsolete \
+ | $(MSGCAT) --use-first --more-than=1 $(MASTER-$(3)) - \
+ | $(MSGCAT) --use-first --less-than=2 $(1) -) \
+ | $(MSGMERGE) --previous $(MASTER-$(3)-OPTION) $(COMPENDIUM-$(3)-OPTION) \
+ -o $(1).tmp - $(2) \
+ && $(call check-new-po,$(1)) && touch $(1) \
&& ($(call update-po-status,$(1)); \
- if test "x$(WDIFF)" != x \
- && { lang=`echo $(1)`; lang=$$$${lang:-xxxx}; \
- lang=$$$${lang%.po}; lang=$$$${lang##*.}; \
- echo $(FUZZY_DIFF_LINGUAS) | $(GREP) -q $$$${lang}; }; \
- then \
- $(ADD-FUZZY-DIFF) --in-place $(1); \
- fi;)
+ $(if $(and $(WDIFF),$(call find-language,$(3),$(FUZZY_DIFF_LINGUAS))), \
+ $(ADD-FUZZY-DIFF) --in-place $(1);) \
+ )
endef
# The command to mail errors from make-prototype.
@@ -540,7 +687,7 @@
define template-rules
.PRECIOUS: $(template-dir)/po/%.$(1).po
-$(template-dir)/po/%.$(1).po: $(template-dir)/po/%.pot
+$(template-dir)/po/%.$(1).po: $(template-dir)/po/%.pot $(MASTER-$(1))
# If the POT is new, it is natural that teams cannot translate it at
# once. Create a copy for every PO file in TEMPLATE_LINGUAS so that
# the build can continue without errors.
@@ -551,7 +698,7 @@
# an old version of gettext. The HTML validation errors should be
# clear even if the bug is in the server templates translations.
-PO=$$@ ; $(check-po)
- $(call update-po,$$@,$$<)
+ $(call update-po,$$@,$$<,$(1))
$(template-dir)/%.$(1).html: $(template-dir)/%.html \
$(template-dir)/po/%.$(1).po
@@ -564,8 +711,7 @@
PO=$(template-dir)/po/$$(*F).$(1).po ; $(check-po) \
|| (touch $$$$PO ; exit 1)
$$(addfile)
- PO=$(template-dir)/po/$$(*F).$(1).po OUT=$$@ ; \
- $(call generate-html,$(1))
+ $(call generate-html,$(1),$(template-dir)/po/$$(*F).$(1).po,$$@)
$(SED) --in-place \
':egin;N;$$$$!begin;s/\([ \t]*\n[ \t]*\)\{3,\}<!--/\n\n<!--/g' $$@
endef
@@ -578,16 +724,16 @@
# rules rather than use static patterns
define extra-template-lang-rules
.PRECIOUS: $(1).$(2).po
-$(1).$(2).po: $(1).pot
+$(1).$(2).po: $(1).pot $(MASTER-$(2))
[ -f $$@ ] || (cp $$< $$@ ; $(VCSSKIP) $(vcs) add $$@)
-PO=$$@ ; $(check-po)
- $(call update-po,$$@,$$<)
+ $(call update-po,$$@,$$<,$(2))
$(subst /po/,/,$(1)).$(2).html: $(subst /po/,/,$(1)).html \
$(1).$(2).po
PO=$(1).$(2).po ; $(check-po) || (touch $$$$PO ; exit 1)
$$(addfile)
- PO=$(1).$(2).po OUT=$$@ ; $(call generate-html,$(2))
+ $(call generate-html,$(2),$(1).$(2).po,$$@)
$(SED) --in-place \
':egin;N;$$$$!begin;s/\([ \t]*\n[ \t]*\)\{3,\}<!--/\n\n<!--/g' $$@
endef
@@ -692,22 +838,11 @@
$(template-dir)/po/whatsnew.%.po \
$(template-dir)/whatsnew.%.include \
generic.%.html
-# Check if the language is defined TEMPLATE_LINGUAS. Unfortunately,
-# we can't use make conditionals since automatic variables are only
-# within the scope of the recipe.
-ifndef NOTIFYSKIP
- if [ -z $(findstring $*,$(TEMPLATE_LINGUAS)) ]; then \
+ $(if $(call find-language,$*,$(TEMPLATE_LINGUAS)),, \
echo 'The "$*" language code is not defined in TEMPLATE_LINGUAS.' \
- | mail $(transl-addr) -s \
- "[GNUN Error] Could not build $$(subst $$(rootdir)/,,$$@)"; \
- exit 1; \
- fi
-else
- if [ -z $(findstring $*,$(TEMPLATE_LINGUAS)) ]; then \
- echo 'The "$*" language code is not defined in TEMPLATE_LINGUAS.'; \
- exit 1; \
- fi
-endif
+ $(if $(NOTIFYSKIP),, | mail $(transl-addr) -s \
+ "[GNUN Error] Could not build $(subst $(rootdir)/,,$@)"); \
+ exit 1)
PO=$(template-dir)/po/whatsnew.$*.po ; $(MAILFAIL) \
$(NOTIFYSKIP) $(transl-addr) \
"[GNUN Error] $${PO#../../} is not a valid PO file" \
@@ -716,13 +851,12 @@
[ -f $(template-dir)/$(@F) ] \
|| (touch $(template-dir)/$(@F) ; \
$(VCSSKIP) $(vcs) add $(template-dir)/$(@F))
-# Unconditionally update the PO file; see the comment in `article-rules'.
- $(MSGMERGE) --update --previous $(template-dir)/po/whatsnew.$*.po \
- $(template-dir)/po/whatsnew.pot
- PO=$(template-dir)/po/whatsnew.$*.po \
- OUT=$(template-dir)/po/whatsnew.$*.m4 ; $(PO4A_TRANSLATE) \
- $(PO4A-XHTMLFLAGS) $(PO4A-TRANSLATEFLAGS) --master $< \
- --po $$PO --localized $$OUT
+# Unconditionally update the PO file; see the comment in `generate-html'.
+ $(call update-po,$(template-dir)/po/whatsnew.$*.po,\
+ $(template-dir)/po/whatsnew.pot,$*)
+ $(PO4A_TRANSLATE) $(PO4A-XHTMLFLAGS) $(PO4A-TRANSLATEFLAGS) \
+ --master $< --po $(template-dir)/po/whatsnew.$*.po \
+ --localized $(template-dir)/po/whatsnew.$*.m4
$(SED) --in-place \
"s/\(<gnun>m4_include(\`.*\)\([.]html')<\/gnun>\)/\1.$*\2/g" \
$(template-dir)/po/whatsnew.$*.m4
@@ -776,15 +910,15 @@
$(generate-pot)
define home-rules
-$(rootdir)/po/$(2).$(1).po: $(rootdir)/po/$(2).pot
+$(rootdir)/po/$(2).$(1).po: $(rootdir)/po/$(2).pot $(MASTER-$(1))
PO=$$@ ; $(check-po)
$$(fixperm)
- $(call update-po,$$@,$$<)
+ $(call update-po,$$@,$$<,$(1))
$(rootdir)/$(2).$(1).html: $(rootdir)/po/$(2).proto \
$(rootdir)/po/$(2).$(1).po generic.$(1).html
# Check if the language is present in TEMPLATE_LINGUAS.
-ifeq (,$(findstring $(1),$(TEMPLATE_LINGUAS)))
+ifeq (,$(call find-language,$(1),$(TEMPLATE_LINGUAS)))
ifndef NOTIFYSKIP
echo 'The "$(1)" language code is not defined in TEMPLATE_LINGUAS.' \
| mail $(transl-addr) -s \
@@ -793,15 +927,15 @@
@echo 'The "$(1)" language code is not defined in TEMPLATE_LINGUAS.'
endif
exit 1
-endif
+endif # eq (,$(call find-language,$(1),$(TEMPLATE_LINGUAS)))
# If $PO is not valid, then the generated page could be broken even
# for the reader. Ensure that the build still barfs next time if the
# translator doesn't fix it quickly.
PO=$(rootdir)/po/$(2).$(1).po ; $(check-po) || (touch $$$$PO ; exit 1)
$$(addfile)
$$(fixperm)
- PO=$(rootdir)/po/$(2).$(1).po OUT=$(rootdir)/po/$(2).$(1).m4 ; \
- $(call generate-html,$(1))
+ $(call generate-html,$(1), \
+ $(rootdir)/po/$(2).$(1).po,$(rootdir)/po/$(2).$(1).m4)
$(SED) --in-place \
"s/\(<gnun>m4_include(\`.*\)\([.]html')<\/gnun>\)/\1.$(1)\2/g" \
$(rootdir)/po/$(2).$(1).m4
@@ -862,10 +996,10 @@
endef
define article-rules
-$(1).po: $(basename $(1)).pot
+$(1).po: $(basename $(1)).pot $(MASTER-$(2))
PO=$$@ ; $(check-po)
$$(fixperm)
- $(call update-po,$$@,$$<)
+ $(call update-po,$$@,$$<,$(2))
$(subst /po/,/,$(1).html): $(basename $(1)).proto \
$(1).po generic.$(2).html
@@ -874,7 +1008,7 @@
# validation is not enforced there will be Apache error. The case
# when the templates are present but not built by GNUN is valid in
# practice, but not recommended.
-ifeq (,$(findstring $(2),$(TEMPLATE_LINGUAS)))
+ifeq (,$(call find-language,$(2),$(TEMPLATE_LINGUAS)))
ifndef NOTIFYSKIP
echo 'The "$(2)" language code is not defined in TEMPLATE_LINGUAS.' \
| mail $(transl-addr) -s \
@@ -902,7 +1036,7 @@
# This is needed for only a few articles, but as it is harmless there
# is no real need to determine them and run the command conditionally.
$$(fixperm)
- PO=$(1).po OUT=$(1).m4 ; $(call generate-html,$(2))
+ $(call generate-html,$(2),$(1).po,$(1).m4)
$(SED) --in-place \
"s/\(<gnun>m4_include(\`.*\)\([.]html')<\/gnun>\)/\1.$(2)\2/g" $(1).m4
$(SED) --in-place "s/<gnun>\(.*\)<\/gnun>/\1/g" $(1).m4
@@ -1017,7 +1151,7 @@
ifndef TEAM
$(error Please specify a language code, for example TEAM=fr)
endif
-ifneq ($(TEAM),$(findstring $(TEAM),$(sort $(GENERIC_LINGUAS))))
+ifneq ($(TEAM),$(call find-language,$(TEAM),$(sort $(GENERIC_LINGUAS))))
@echo "There are no translations for language $(TEAM)."
else
@cd $(rootdir) ; LC_ALL=C find -name '*.$(TEAM).po' -printf "%p: " \
Index: Makefile.am
===================================================================
RCS file: /sources/trans-coord/trans-coord/gnun/server/gnun/Makefile.am,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -b -r1.25 -r1.26
--- Makefile.am 30 Jan 2012 08:49:13 -0000 1.25
+++ Makefile.am 17 Mar 2012 15:00:23 -0000 1.26
@@ -30,7 +30,7 @@
endif
noinst_SCRIPTS = stamp-config.mk
-pkglibexec_SCRIPTS = expand-m4-includes update-localized-urls \
+pkglibexec_SCRIPTS = copy-msgid expand-m4-includes update-localized-urls \
validate-html-notify
if HAVE_WDIFF
@@ -60,8 +60,8 @@
-e 's|@address@hidden|$(SED)|g' \
-e 's|@address@hidden|$(WDIFF)|g'
-add-fuzzy-diff expand-m4-includes gnun-add-fuzzy-diff gnun-validate-html \
-update-localized-urls validate-html-notify: Makefile
+add-fuzzy-diff copy-msgid expand-m4-includes gnun-add-fuzzy-diff \
+gnun-validate-html update-localized-urls validate-html-notify: Makefile
$(AM_V_at)rm -f $@ address@hidden
$(AM_V_GEN)$(edit) '$(srcdir)/address@hidden' >address@hidden
$(AM_V_at)chmod +x address@hidden
@@ -73,6 +73,7 @@
$(AM_V_at)touch $@
add-fuzzy-diff: $(srcdir)/add-fuzzy-diff.in
+copy-msgid: $(srcdir)/copy-msgid.in
expand-m4-includes: $(srcdir)/expand-m4-includes.in
gnun-validate-html: $(srcdir)/gnun-validate-html.in
gnun-add-fuzzy-diff: $(srcdir)/gnun-add-fuzzy-diff.in
@@ -89,10 +90,10 @@
dist_sysconf_DATA = gnun.conf
dist_pkgdata_DATA = GNUmakefile
-EXTRA_DIST = add-fuzzy-diff.in expand-m4-includes.in gnun-add-fuzzy-diff.in \
+EXTRA_DIST = add-fuzzy-diff.in copy-msgid.in expand-m4-includes.in
gnun-add-fuzzy-diff.in \
gnun-validate-html.in update-localized-urls.in \
validate-html-notify.in
-CLEANFILES = add-fuzzy-diff expand-m4-includes gnun-add-fuzzy-diff \
+CLEANFILES = add-fuzzy-diff copy-msgid expand-m4-includes gnun-add-fuzzy-diff \
gnun-validate-html update-localized-urls validate-html-notify \
stamp-config.mk
Index: NEWS
===================================================================
RCS file: /sources/trans-coord/trans-coord/gnun/server/gnun/NEWS,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -b -r1.47 -r1.48
--- NEWS 30 Jan 2012 14:57:05 -0000 1.47
+++ NEWS 17 Mar 2012 15:00:23 -0000 1.48
@@ -1,5 +1,16 @@
GNUnited Nations NEWS - User visible changes.
+* Changes in GNUnited Nations 0.6 (????-??-??)
+
+** Support compendia.
+
+** Bugs fixed in 0.6.
+
+*** `extra-templates' didn't work with files from the topmost directory.
+
+*** When adding language suffix to the URLs of localized templates,
+ the full string is checked, not just the end of it.
+
* Changes in GNUnited Nations 0.5 (2012-01-30)
** Multivews support.
Index: config.mk
===================================================================
RCS file: /sources/trans-coord/trans-coord/gnun/server/gnun/config.mk,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- config.mk 25 Dec 2011 08:01:31 -0000 1.8
+++ config.mk 17 Mar 2012 15:00:24 -0000 1.9
@@ -9,6 +9,8 @@
GREP := grep
EGREP := grep -E
M4 := ./expand-m4-includes
+MSGATTRIB := msgattrib
+MSGCAT := msgcat
MSGFMT := msgfmt
MSGMERGE := msgmerge
PO4A_GETTEXTIZE := po4a-gettextize
Index: config.mk.in
===================================================================
RCS file: /sources/trans-coord/trans-coord/gnun/server/gnun/config.mk.in,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- config.mk.in 25 Dec 2011 08:01:31 -0000 1.8
+++ config.mk.in 17 Mar 2012 15:00:25 -0000 1.9
@@ -10,6 +10,8 @@
EGREP := @EGREP@
# We actually use our sed script rather than a real m4.
M4 := @M4@
+MSGATTRIB := @MSGATTRIB@
+MSGCAT := @MSGCAT@
MSGFMT := @MSGFMT@
MSGMERGE := @MSGMERGE@
PO4A_GETTEXTIZE := @PO4A_GETTEXTIZE@
Index: configure.ac
===================================================================
RCS file: /sources/trans-coord/trans-coord/gnun/server/gnun/configure.ac,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -b -r1.33 -r1.34
--- configure.ac 26 Jan 2012 17:39:59 -0000 1.33
+++ configure.ac 17 Mar 2012 15:00:25 -0000 1.34
@@ -102,6 +102,8 @@
AC_ARG_VAR([MSGFMT], [the `msgfmt' program])
AC_CHECK_PROGS([MSGFMT], [msgfmt gmsgfmt])
+AC_ARG_VAR([MSGCAT], [the `msgcat' program])
+AC_CHECK_PROGS([MSGCAT], [msgcat gmsgcat])
AC_ARG_VAR([MSGMERGE], [the `msgmerge' program])
AC_CACHE_CHECK([for msgmerge that supports --previous],
[ac_cv_path_MSGMERGE],
Index: doc/gnun.texi
===================================================================
RCS file: /sources/trans-coord/trans-coord/gnun/server/gnun/doc/gnun.texi,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -b -r1.49 -r1.50
--- doc/gnun.texi 13 Mar 2012 04:38:03 -0000 1.49
+++ doc/gnun.texi 17 Mar 2012 15:00:40 -0000 1.50
@@ -202,6 +202,10 @@
Nevertheless, a few hints are given in some other chapter of this
manual.
+It is possible to make GNUN get translations for common strings from
+dedicated PO files, so called compendia. @xref{Compendia}, for more
+information.
+
@ignore
(FIXME:Translators (but only if we would like to include some
practical advices to candidate translators on how to join a gnu.org
@@ -961,6 +965,8 @@
* languages.txt:: Specifying canonical names for languages.
* PO Files and Team:: How to maintain translations in the team's
repository.
+* Compendia:: Using translation memory.
+
@end menu
@node New Translation
@@ -1742,6 +1748,49 @@
`\' as a line continuation character---the example shown is made that
way for better readability.
address@hidden Compendia
address@hidden Using Compendia
address@hidden compendia
address@hidden translation memory
address@hidden exclude.pot
address@hidden compendium.pot
+
+Compendium is a PO file including translations for common strings; it is
+used to fill other PO files. @xref{Compendium, gettext, Compendium,
+gettext, GNU gettext}. One example of such common strings is the footer
+text about reporting bugs and sending inquiries: when a webmaster
+updates footer texts in an article, GNUN will use compendia to
+automatically fill the translations for the new version of the strings.
+
+GNUN uses compendia located in @file{server/gnun/compendia} directory in
+the `www' web repository. There are two kinds of compendia:
address@hidden@var{lang}.po} and @address@hidden
+
+The first kind, @address@hidden, can be used to
+simultaneously update all occurrences of the translations of a given
+string. Translations from this file will override the translations from
address@hidden@address@hidden When @address@hidden is
+updated, the translations will be rebuilt. GNUN doesn't modify this
+kind of compendia.
+
+The second kind, @address@hidden, is updated
+automatically. GNUN finds strings that repeat many times in POTs of
+articles and collects them in @file{compendium.pot}. Then GNUN checks
+all available @address@hidden@var{lang}.po} files for translations
+of those strings and generates @address@hidden This
+file is also used to fill missing translations, but it doesn't override
+the translations from @address@hidden@var{lang}.po}, and the
+strings coming from @address@hidden are always marked as
+``fuzzy''.
+
+When updating @file{compendium.pot}, some strings should be excluded
+even though they repeat in the POT files many times, for instance, GNUN
+slots for translators' notes. @xref{Note Slot}. They are not real
+translations, this is why they are likely to be differrent for different
+articles. In order to avoid including them in compendia, GNUN checks a
+specific file, @file{exclude.pot}, and when that file contains the the
+string, it won't be added to @file{compendium.pot}.
+
@node Webmaster Tips
@section Tips and Hints for Webmasters
@cindex tips, webmasters
Index: copy-msgid
===================================================================
RCS file: copy-msgid
diff -N copy-msgid
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ copy-msgid 17 Mar 2012 15:00:29 -0000 1.1
@@ -0,0 +1,35 @@
+#! /bin/sed -f
+
+# Copyright (C) 2012 Free Software Foundation, Inc.
+
+# This file is part of GNUnited Nations.
+
+# GNUnited Nations is free software: you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+
+# GNUnited Nations is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with GNUnited Nations. If not, see <http://www.gnu.org/licenses/>.
+
+# Copy current msgid as `previous' when the latter is absent.
+
+/^#.*, fuzzy/ {
+ p; s/.*//;
+ :collect; N;
+ # There is already previous msgid; skip the string.
+ /\n#| [^\n]*$/ b skip;
+ # Leave comments as is.
+ /\n#/ { s/\n//; p; s/.*//; b collect; }
+ # Collect lines until msgstr is found.
+ /\nmsgstr "[^\n]*$/! b collect;
+ s/^\n//; h;
+ s/\nmsgstr "[^\n]*$//; s/\(\n\)\|\(^\)/\n#| /g;
+ G
+ :skip; s/^\n//;
+}
Index: copy-msgid.in
===================================================================
RCS file: copy-msgid.in
diff -N copy-msgid.in
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ copy-msgid.in 17 Mar 2012 15:00:39 -0000 1.1
@@ -0,0 +1,35 @@
+#! @SED@ -f
+
+# Copyright (C) 2012 Free Software Foundation, Inc.
+
+# This file is part of GNUnited Nations.
+
+# GNUnited Nations is free software: you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+
+# GNUnited Nations is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with GNUnited Nations. If not, see <http://www.gnu.org/licenses/>.
+
+# Copy current msgid as `previous' when the latter is absent.
+
+/^#.*, fuzzy/ {
+ p; s/.*//;
+ :collect; N;
+ # There is already previous msgid; skip the string.
+ /\n#| [^\n]*$/ b skip;
+ # Leave comments as is.
+ /\n#/ { s/\n//; p; s/.*//; b collect; }
+ # Collect lines until msgstr is found.
+ /\nmsgstr "[^\n]*$/! b collect;
+ s/^\n//; h;
+ s/\nmsgstr "[^\n]*$//; s/\(\n\)\|\(^\)/\n#| /g;
+ G
+ :skip; s/^\n//;
+}
- trans-coord/gnun/server/gnun AUTHORS ChangeLog ...,
Pavel Kharitonov <=