trans-coord-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

trans-coord/gnun/server/gnun ChangeLog GNUmakef...


From: Ineiev
Subject: trans-coord/gnun/server/gnun ChangeLog GNUmakef...
Date: Sun, 16 Dec 2018 01:46:02 -0500 (EST)

CVSROOT:        /sources/trans-coord
Module name:    trans-coord
Changes by:     Ineiev <ineiev> 18/12/16 01:46:02

Modified files:
        gnun/server/gnun: ChangeLog GNUmakefile NEWS 
        gnun/server/gnun/doc: gnun.texi 

Log message:
        Add per-directory compendia.
        
        * GNUmakefile (whole-dir-pots, whole-dirs): New variables.
        (merge-whole-dirs): New .PHONY target.
        (all): Add merge-whole-dirs.
        (list-langs, merge-dir-po, la-po-rule, merge-dir): New functions.
        * gnun.texi (Site-Wide Compendia, Per-Directory Compendia):
        New subsections.
        (Compendia): Split to introduction, Site-Wide Compendia
        and Per-Directory Compendia.
        (Files and Directories): Update diagram.
        * NEWS: Update.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/trans-coord/gnun/server/gnun/ChangeLog?cvsroot=trans-coord&r1=1.469&r2=1.470
http://cvs.savannah.gnu.org/viewcvs/trans-coord/gnun/server/gnun/GNUmakefile?cvsroot=trans-coord&r1=1.193&r2=1.194
http://cvs.savannah.gnu.org/viewcvs/trans-coord/gnun/server/gnun/NEWS?cvsroot=trans-coord&r1=1.134&r2=1.135
http://cvs.savannah.gnu.org/viewcvs/trans-coord/gnun/server/gnun/doc/gnun.texi?cvsroot=trans-coord&r1=1.112&r2=1.113

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/trans-coord/trans-coord/gnun/server/gnun/ChangeLog,v
retrieving revision 1.469
retrieving revision 1.470
diff -u -b -r1.469 -r1.470
--- ChangeLog   25 Nov 2018 12:46:14 -0000      1.469
+++ ChangeLog   16 Dec 2018 06:46:02 -0000      1.470
@@ -1,3 +1,19 @@
+2018-12-16  Pavel Kharitonov  <address@hidden>
+
+       Add per-directory compendia.
+
+       * GNUmakefile (whole-dir-pots, whole-dirs): New variables.
+       (merge-whole-dirs): New .PHONY target.
+       (all): Add merge-whole-dirs.
+       (list-langs, merge-dir-po, la-po-rule, merge-dir):
+       New functions.
+       * gnun.texi (Site-Wide Compendia, Per-Directory Compendia):
+       New subsections.
+       (Compendia): Split to introduction, Site-Wide Compendia
+       and Per-Directory Compendia.
+       (Files and Directories): Update diagram.
+       * NEWS: Update.
+
 2018-11-25  Pavel Kharitonov  <address@hidden>
 
        Make GRACE eternal.

Index: GNUmakefile
===================================================================
RCS file: /sources/trans-coord/trans-coord/gnun/server/gnun/GNUmakefile,v
retrieving revision 1.193
retrieving revision 1.194
diff -u -b -r1.193 -r1.194
--- GNUmakefile 25 Nov 2018 12:46:16 -0000      1.193
+++ GNUmakefile 16 Dec 2018 06:46:02 -0000      1.194
@@ -175,6 +175,16 @@
 endif
 ### End of variables for sitemap
 
+# When a 'po' directory contains a file named 'pot', it is
+# used as the whole-directory POT file.  Translations from all *.$lang.po
+# are merged to '$lang.po', then it is used as a compendium to distribute
+# translations from one 'file.$lang.po' to other $lang translations
+# in the same directory.
+whole-dir-pots := $(wildcard $(rootdir)/pot)\
+  $(foreach dir,$(ALL_DIRS),$(wildcard $(rootdir)/$(dir)/po/pot))
+
+whole-dirs := $(patsubst %/pot,%,$(whole-dir-pots))
+
 ### Special variables for all other articles ###
 articles := $(foreach dir,$(ALL_DIRS),$(addprefix $(dir)/po/,$(value $(dir))))
 articles-pot := $(addprefix $(rootdir)/,$(articles:%=%.pot))
@@ -192,12 +202,12 @@
 endif
 ### End of variables for all other articles ###
 
-.PHONY: all no-grace-items
+.PHONY: all merge-whole-dirs no-grace-items
 ifeq ($(_have-Makefile),yes)
 include Makefile
 else
 all: compendia $(template-pots) $(template-translated) \
-     $(ALL_POTS) \
+     $(ALL_POTS) merge-whole-dirs \
      $(articles-translated) $(patsubst %.pot,%.translist,$(ALL_POTS)) \
      final-stage
 endif
@@ -205,6 +215,70 @@
                $(no-grace-translated) \
                $(patsubst %.pot,%.translist,$(no-grace-pot)) final-stage
 
+merge-whole-dirs: $(foreach d,$(whole-dirs),merge-whole-dir-$(d))
+
+# List all langugage suffixes existing in the $(1) directory.
+define list-langs
+$$(sort $$(subst .,,$$(suffix $$(basename $$(wildcard $(1)/*.po)))))
+endef
+
+# merge-dir-po: Define a rule to merge PO file $(1) with the per-directory
+# compendium $(2) for its language.
+#
+# $(MSGATTRIB) --fuzzy... $(1): output fuzzy strings from $(article).
+# | $(MSGCAT) --use-first... -: output strings that are also available
+#                               in $(lang).po.
+# | $(MSGATTRIB) --no-fuzzy...: only output up-to-date translations.
+# | $(MSGCAT) --use-first... -: remove the previous result line
+#                               from $(article).
+# $(MSGMERGE) ...: add translations from $(lang).po to $(article).
+# $(if ...,true): add fuzzy-diffs when needed.
+define merge-dir-po
+$(1)-merge: $(1) $(2)
+       $(MSGATTRIB) --fuzzy --no-obsolete --translated $(1) \
+  | $(MSGCAT) --use-first --more-than=1 $(2) - \
+  | $(MSGATTRIB) --no-fuzzy --translated \
+  | $(MSGCAT) --use-first --less-than=2 -o $(1) $(1) -
+       $(MSGMERGE) --backup=none --update --previous -C $(2) \
+  $(1) $$(basename $$(basename $(1))).pot
+       $$(if $$(and $(WDIFF),$$(call find-language,$$(basename $$(notdir 
$(2))),\
+                                   $(FUZZY_DIFF_LINGUAS))), \
+           $(ADD-FUZZY-DIFF) --in-place $(1),true)
+endef
+
+# Define rules for merging strings from directory $(2) for language $(1).
+define la-po-rule
+.PHONY: merge-dir-pos-$(2)-$(1)
+merge-whole-dir-$(2): merge-dir-pos-$(2)-$(1)
+.PHONY: $$(addsuffix -merge,$$(wildcard $(2)/*.$(1).po))
+$(2)/$(1).po: $(2)/pot $(wildcard $(2)/*.$(1).po)
+       test -f $$@ || touch $$@
+       $(MSGMERGE) $(addprefix -C ,$(wildcard $(2)/*.$(1).po)) \
+                   --update --previous --backup=none $(2)/$(1).po $(2)/pot
+merge-dir-pos-$(2)-$(1): $(2)/$(1).po $(wildcard $(2)/*.$(1).po) \
+  $(addsuffix -merge,$(wildcard $(2)/*.$(1).po))
+$$(foreach po,$(wildcard $(2)/*.$(1).po),$$(eval \
+  $$(call merge-dir-po,$${po},$(2)/$(1).po)))
+endef
+
+# Define per-directory compendium-specific rules for directory $(1).
+define merge-dir
+DIR-LANGS := $(call list-langs,$(1))
+merge-whole-dir-$(1): $(1)/pot \
+  $$(addsuffix .po,$$(addprefix $(1)/,$$(DIR-LANGS)))
+$(1)/pot: $(wildcard $(1)/*.pot)
+       msgcat --use-first $$^ -o $$@
+       $(SED) --in-place \
+  '1s,https.*,files in $(patsubst $(rootdir)/%,%,$(1))/,; \
+   1,/^"Project-Id-Version:/ \
+     s,^\("Project-Id-Version:\).*,\1 $(patsubst $(rootdir)/%,%,$(1))/\\n",' \
+   $$@
+$$(foreach la,$$(DIR-LANGS),\
+  $$(eval $$(call la-po-rule,$$(la),$(1))))
+endef
+
+$(foreach d,$(whole-dirs),$(eval $(call merge-dir,$(d))))
+
 .PHONY: substitute-localized-urls update-localized-URLs final-stage
 
 # Unconditional actions to run at the end of build process.

Index: NEWS
===================================================================
RCS file: /sources/trans-coord/trans-coord/gnun/server/gnun/NEWS,v
retrieving revision 1.134
retrieving revision 1.135
diff -u -b -r1.134 -r1.135
--- NEWS        25 Nov 2018 12:46:16 -0000      1.134
+++ NEWS        16 Dec 2018 06:46:02 -0000      1.135
@@ -2,6 +2,8 @@
 
 * Changes in GNUnited Nations 0.12 (????-??-??)
 
+** New experimental feature: per-directory compendia.
+
 ** GRACE doesn't define grace period in days any more: any defined
    value specify an unlimited period.
 

Index: doc/gnun.texi
===================================================================
RCS file: /sources/trans-coord/trans-coord/gnun/server/gnun/doc/gnun.texi,v
retrieving revision 1.112
retrieving revision 1.113
diff -u -b -r1.112 -r1.113
--- doc/gnun.texi       25 Nov 2018 12:46:16 -0000      1.112
+++ doc/gnun.texi       16 Dec 2018 06:46:02 -0000      1.113
@@ -931,9 +931,6 @@
 @section Using Compendia
 @cindex compendia
 @cindex translation memory
address@hidden exclude.pot
address@hidden master.lang.po
address@hidden compendium.pot
 
 Compendium is a PO file including translations for common strings; it is
 used to fill other PO files.  @xref{Compendium, Compendium, Using
@@ -943,7 +940,33 @@
 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 the @file{server/gnun/compendia}
+GNUN has two types of compendia:
+
address@hidden
address@hidden Site-Wide Compendia
+This type is used for all articles, and only contains common strings.
+
address@hidden Per-Directory Compedia
+These files accumulate all strings from all articles in the directory,
+even if these strings are not repeated in different articles.
address@hidden enumerate
+
address@hidden
+* Site-Wide Compendia::          Common translations for all articles
+* Per-Directory Templates::      Files that contain all strings
+                                   from all articles in the directory
address@hidden menu
+
address@hidden Site-Wide Compendia
address@hidden Site-Wide Compendia
address@hidden compendia, site-wide
address@hidden site-wide compendia
address@hidden exclude.pot
address@hidden master.lang.po
address@hidden compendium.lang.po
address@hidden compendium.pot
+
+Site-wide compendia are located in the @file{server/gnun/compendia}
 directory of the `www' web repository.  There are two kinds of
 compendia: @address@hidden and
 @address@hidden
@@ -975,6 +998,26 @@
 GNUN checks a specific file, @file{exclude.pot}, and when that file
 contains the string, it won't be added to @file{compendium.pot}.
 
address@hidden Per-Directory Templates
address@hidden Per-Directory Templates
address@hidden compendia, per-directory
address@hidden per-directory compendia
address@hidden pot
address@hidden lang.po
+
+When GNUN detects a file named @file{pot} in some @file{po} directory,
+it writes to it all strings from all articles in the same directory;
+it also merges translations of those strings to files named
address@hidden@var{lang}.po}, for all languages available in that directory.
+In its turn, files @address@hidden are used to update
+translations in articles from that directory.
+
+This helps updating translations in sets of articles like
address@hidden/} section, where an item may belong to many files
+at once.  The translator can only update @address@hidden,
+or any article where the outdated item is listed.  Then GNUN
+will copy the translation to all other places.
+
 @node Sitemap
 @section Building Sitemap
 @cindex sitemap
@@ -2150,27 +2193,27 @@
 @group
 Root/
   |
-  +--gnu/
+  +--proprietary/
   |   |
-  |   +--linux-and-gnu.html #
-  |   address@hidden @@
-  |   +--manifesto.html #
-  |   address@hidden @@
+  |   +--proprietary.html #
+  |   address@hidden @@
+  |   +--malware-cars.html #
+  |   address@hidden @@
   |   address@hidden
   |   |
   |   +--------------------------po/
   |                               |
-  +--home.html #                  address@hidden %
-  address@hidden @@             +--manifesto.pot @@
-  +--planetfeeds.html #/@@         +--manifesto.proto * @@
-  address@hidden @@      +--manifesto.translist @@
+  +--home.html #                  address@hidden %
+  address@hidden @@             +--malware-cars.pot @@
+  +--planetfeeds.html #/@@         +--malware-cars.proto * @@
+  address@hidden @@      +--malware-cars.translist @@
   +--po/                          |
-  |  |                            address@hidden @@
-  |  +--home.pot @@                address@hidden @@
-  |  +--home.proto * @@            address@hidden %
-  |  +--home.translist @@          address@hidden
-  |  address@hidden %
-  |  address@hidden @@
+  |  |                            address@hidden @@
+  |  +--home.pot @@                address@hidden @@
+  |  +--home.proto * @@            address@hidden %
+  |  +--home.translist @@          +--pot @@
+  |  address@hidden %            address@hidden %
+  |  address@hidden @@       address@hidden
   |  address@hidden @@
   |  +--planetfeeds.proto * @@
   |  +--planetfeeds.pot.opt @@
@@ -2239,6 +2282,14 @@
 @address@hidden@var{file}.html} and
 @address@hidden/po/@address@hidden
 
address@hidden @dots{}/po/pot
+Per-directory template.  It contains all strings from all articles
+in this directory.  @xref{Per-Directory Templates}.
+
address@hidden @dots{}/po/@var{lang}.po
+Per-directory compendium.  It is only used and regenerated when
address@hidden@dots{}/po/pot} exists.  @xref{Per-Directory Templates}.
+
 @item planetfeeds.html
 A list of news; it is automatically generated outside of GNUN.
 For GNUN, it is an optional template.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]