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

[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: Sun, 13 Nov 2011 11:19:03 +0000

CVSROOT:        /sources/trans-coord
Module name:    trans-coord
Changes by:     Pavel Kharitonov <ineiev>       11/11/13 11:19:03

Modified files:
        gnun/server/gnun: AUTHORS ChangeLog GNUmakefile Makefile.am NEWS 
                          THANKS 
        gnun/server/gnun/doc: gnun.texi web-trans.texi 
Added files:
        gnun/server/gnun: update-localized-urls update-localized-urls.in 

Log message:
        Add support for localized URLs (in particular, localized
        diagrams).
        
        Document OUTDATED-GRACE, no-grace-items, languages.txt.
        
        Declare that the encoding should be UTF-8; don't restrict
        the English texts to ASCII-only.
        
        * update-localized-urls.in: New file.
        * GNUmakefile (UPDATE-LOCALIZED-URLS): New variable.
        (final-stage, substitute-localized-urls)
        (update-localized-urls): New targets.
        (all, no-grace-items): Invoke `final-stage'.
        * Makefile.am (pkglibexec_SCRIPTS)
        (CLEANFILES): Add `update-localized-urls'.
        (EXTRA_DIST): Add `update-localized-urls.in'.
        (expand-m4-includes, update-localized-urls): Add dependencies
        on their %.in files.
        * doc/web-trans.texi (SSI): Require UTF-8 for all translations.
        * doc/gnun.texi (Webmaster Tips): Don't restrict the English
        texts to ASCII-only.  Document support of localized URLs.
        (languages.txt, no-grace-items, update-localized-urls): New
        nodes.
        (Runtime Variables): Add `OUTDATED-GRACE'.
        (Disadvantages): Note that `no-grace' articles are rebuilt
        hourly.
        (Webmaster Tips): Add `Localized URLs'; split the section
        into subsections.
        * AUTHORS:
        * NEWS:
        * THANKS: Update.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/trans-coord/gnun/server/gnun/AUTHORS?cvsroot=trans-coord&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/trans-coord/gnun/server/gnun/ChangeLog?cvsroot=trans-coord&r1=1.211&r2=1.212
http://cvs.savannah.gnu.org/viewcvs/trans-coord/gnun/server/gnun/GNUmakefile?cvsroot=trans-coord&r1=1.100&r2=1.101
http://cvs.savannah.gnu.org/viewcvs/trans-coord/gnun/server/gnun/Makefile.am?cvsroot=trans-coord&r1=1.22&r2=1.23
http://cvs.savannah.gnu.org/viewcvs/trans-coord/gnun/server/gnun/NEWS?cvsroot=trans-coord&r1=1.36&r2=1.37
http://cvs.savannah.gnu.org/viewcvs/trans-coord/gnun/server/gnun/THANKS?cvsroot=trans-coord&r1=1.10&r2=1.11
http://cvs.savannah.gnu.org/viewcvs/trans-coord/gnun/server/gnun/update-localized-urls?cvsroot=trans-coord&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/trans-coord/gnun/server/gnun/update-localized-urls.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.27&r2=1.28
http://cvs.savannah.gnu.org/viewcvs/trans-coord/gnun/server/gnun/doc/web-trans.texi?cvsroot=trans-coord&r1=1.17&r2=1.18

Patches:
Index: AUTHORS
===================================================================
RCS file: /sources/trans-coord/trans-coord/gnun/server/gnun/AUTHORS,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- AUTHORS     5 Nov 2011 04:16:17 -0000       1.5
+++ AUTHORS     13 Nov 2011 11:19:02 -0000      1.6
@@ -8,12 +8,13 @@
     Add 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),
-        translinks-head.html, translinks-tail.html.
+        translinks-head.html, translinks-tail.html,
+        update-localized-urls.in.
 
-    Some changes in GNUmakefile, gnun-validate-html, README,
-        dtd/README.
+    Some changes in GNUmakefile, gnun-validate-html, Makefile.am,
+        README, dtd/README, doc/gnun.texi, doc/web-trans.texi.
 
-    Tiny changes in Makefile.am, config.mk.in, configure.ac,
+    Tiny changes in config.mk.in, configure.ac,
         dtd/Makefile.am, validate-html-notify.in.
 
 Brett Smith <address@hidden>

Index: ChangeLog
===================================================================
RCS file: /sources/trans-coord/trans-coord/gnun/server/gnun/ChangeLog,v
retrieving revision 1.211
retrieving revision 1.212
diff -u -b -r1.211 -r1.212
--- ChangeLog   12 Nov 2011 19:54:55 -0000      1.211
+++ ChangeLog   13 Nov 2011 11:19:02 -0000      1.212
@@ -1,3 +1,37 @@
+2011-11-13  Pavel Kharitonov  <address@hidden>
+
+       Add support for localized URLs (in particular, localized
+       diagrams).
+
+       Document OUTDATED-GRACE, no-grace-items, languages.txt.
+
+       Declare that the encoding should be UTF-8; don't restrict
+       the English texts to ASCII-only.
+
+       * update-localized-urls.in: New file.   
+       * GNUmakefile (UPDATE-LOCALIZED-URLS): New variable.
+       (final-stage, substitute-localized-urls) 
+       (update-localized-urls): New targets.
+       (all, no-grace-items): Invoke `final-stage'.
+       * Makefile.am (pkglibexec_SCRIPTS)
+       (CLEANFILES): Add `update-localized-urls'.
+       (EXTRA_DIST): Add `update-localized-urls.in'.
+       (expand-m4-includes, update-localized-urls): Add dependencies
+       on their %.in files.
+       * doc/web-trans.texi (SSI): Require UTF-8 for all translations.
+       * doc/gnun.texi (Webmaster Tips): Don't restrict the English
+       texts to ASCII-only.  Document support of localized URLs.
+       (languages.txt, no-grace-items, update-localized-urls): New
+       nodes.
+       (Runtime Variables): Add `OUTDATED-GRACE'.
+       (Disadvantages): Note that `no-grace' articles are rebuilt
+       hourly.
+       (Webmaster Tips): Add `Localized URLs'; split the section
+       into subsections.
+       * AUTHORS:
+       * NEWS:
+       * THANKS: Update.
+
 2011-11-12  Pavel Kharitonov  <address@hidden>
 
        * doc/web-trans.texi (SSI): Document new templates,

Index: GNUmakefile
===================================================================
RCS file: /sources/trans-coord/trans-coord/gnun/server/gnun/GNUmakefile,v
retrieving revision 1.100
retrieving revision 1.101
diff -u -b -r1.100 -r1.101
--- GNUmakefile 5 Nov 2011 06:08:24 -0000       1.100
+++ GNUmakefile 13 Nov 2011 11:19:02 -0000      1.101
@@ -29,6 +29,7 @@
 VALIDATE-HTML-NOTIFY := $(pkglibexecdir)/validate-html-notify
 MAILFAIL := $(pkglibexecdir)/mailfail
 MAKE-PROTOTYPE := $(pkglibexecdir)/make-prototype
+UPDATE-LOCALIZED-URLS := $(pkglibexecdir)/update-localized-urls
 
 PO4A-GETTEXTIZEFLAGS := -o porefs=none
 PO4A-TRANSLATEFLAGS := --keep=0
@@ -162,11 +163,57 @@
 include Makefile
 else
 all: $(template-pots) $(template-translated) $(gnunews) $(home-translated) \
-     $(ALL_POTS) $(staged-originals) $(articles-translated) vcs-add-always
+     $(ALL_POTS) $(staged-originals) $(articles-translated) final-stage
 endif
 no-grace-items: $(template-pots) $(template-translated) \
                $(home-translated) $(staged-originals) \
-               $(no-grace-translated) vcs-add-always
+               $(no-grace-translated) final-stage
+
+.PHONY: substitute-localized-urls update-localized-urls final-stage
+
+# Unconditional actions to run at the end of build process.
+final-stage: substitute-localized-urls vcs-add-always
+
+# Regenerate lists of localized URLs in localized-urls.mk
+update-localized-urls:
+       $(UPDATE-LOCALIZED-URLS)
+-include localized-urls.mk
+
+# Substitute and unsubstitute localised URLs in translations.
+substitute-localized-urls:
+       $(foreach source, ${localized-url-sources}, \
+         langs=$$(echo ${rootdir}/${source}.*.html | \
+                  $(SED) 's%${rootdir}/${source}\.%%g;s/\.html//g;s/\*//'); \
+         test -z "$${langs}" \
+           || for l in $${langs}; do \
+                article=${source}; \
+                po=${rootdir}/$${article%/*}/po/$${article##*/}.$${l}.po; \
+                 test -f "$${po}" || continue; \
+                script=; \
+                for url in ${${source}-localized-urls}; do \
+                  base=$${url%.*}; ext=$${url##*.}; \
+                  escaped_url=$$(echo $${url} | $(SED) 's/\./\\./g'); \
+                  escaped_localized_url=$$(echo $${url%.*}.$${l}.$${url##*.} \
+                                           | $(SED) 's/\./\\./g'); \
+                  if test -f ${rootdir}$${url%.*}.$${l}.$${url##*.}; then \
+                    script="address@hidden@address@hidden; \
+                            $${script}"; \
+                  else \
+                    script="address@hidden@address@hidden; \
+                            $${script}"; \
+                  fi; \
+                done; \
+                script=$$(echo $${script} | $(SED) "s/^ *//g"); \
+                file=${rootdir}/${source}.$${l}.html; \
+                if test -n "$${script}"; then \
+                  $(SED) "$${script}" $${file} \
+                    > $${file}.tmp; \
+                  if ! cmp -s $${file} $${file}.tmp; then \
+                    cp $${file}.tmp $${file}; \
+                  fi; \
+                  $(RM) $${file}.tmp; \
+                fi;\
+              done;)
 
 define staged-rules
 $(1)-staged.html: $(1).html

Index: Makefile.am
===================================================================
RCS file: /sources/trans-coord/trans-coord/gnun/server/gnun/Makefile.am,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -b -r1.22 -r1.23
--- Makefile.am 5 Nov 2011 04:16:19 -0000       1.22
+++ Makefile.am 13 Nov 2011 11:19:02 -0000      1.23
@@ -30,7 +30,8 @@
 endif
 
 noinst_SCRIPTS = stamp-config.mk
-pkglibexec_SCRIPTS = expand-m4-includes validate-html-notify
+pkglibexec_SCRIPTS = expand-m4-includes update-localized-urls \
+ validate-html-notify
 
 if HAVE_GUILE
 pkglibexec_SCRIPTS += make-prototype
@@ -51,10 +52,11 @@
        -e 's|@address@hidden|$(AWK)|g' \
        -e 's|@address@hidden|$(GREP)|g' \
        -e 's|@address@hidden|$(pkglibexecdir)/expand-m4-includes|g' \
-       -e 's|@address@hidden|$(SED)|g'
+       -e 's|@address@hidden|$(SED)|g' \
        -e 's|@address@hidden|$(WDIFF)|g'
 
-expand-m4-includes gnun-validate-html validate-html-notify: Makefile
+expand-m4-includes 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
@@ -65,7 +67,9 @@
        $(AM_V_at)mv $<.tmp $<
        $(AM_V_at)touch $@
 
+expand-m4-includes: $(srcdir)/expand-m4-includes.in
 gnun-validate-html: $(srcdir)/gnun-validate-html.in
+update-localized-urls: $(srcdir)/update-localized-urls.in
 validate-html-notify: $(srcdir)/validate-html-notify.in
 
 exampledir = $(docdir)/examples
@@ -79,7 +83,7 @@
 dist_pkgdata_DATA = GNUmakefile
 
 EXTRA_DIST = expand-m4-includes.in gnun-validate-html.in \
-            validate-html-notify.in
+            update-localized-urls.in validate-html-notify.in
 
-CLEANFILES = expand-m4-includes gnun-validate-html validate-html-notify \
-            stamp-config.mk
+CLEANFILES = expand-m4-includes 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.36
retrieving revision 1.37
diff -u -b -r1.36 -r1.37
--- NEWS        24 Oct 2011 06:24:08 -0000      1.36
+++ NEWS        13 Nov 2011 11:19:03 -0000      1.37
@@ -2,6 +2,9 @@
 
 * Changes in GNUnited Nations 0.5 (201?-??-??)
 
+** Support for localized URLs.  GNUN replaces links to selected
+   images with their localized versions when available.
+
 ** Links to translations are generated outside of `make-prototype'
    based on presence of translations rather than copied from
    the English file.  They are included via SSI rather than pasted

Index: THANKS
===================================================================
RCS file: /sources/trans-coord/trans-coord/gnun/server/gnun/THANKS,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- THANKS      5 Nov 2011 04:16:19 -0000       1.10
+++ THANKS      13 Nov 2011 11:19:03 -0000      1.11
@@ -24,6 +24,8 @@
 +------------------+---------------------------+
 |Richard Stallman  |                address@hidden|
 +------------------+---------------------------+
+|Wacław Jacek      |                address@hidden|
++------------------+---------------------------+
 
 Local Variables:
 mode: text

Index: doc/gnun.texi
===================================================================
RCS file: /sources/trans-coord/trans-coord/gnun/server/gnun/doc/gnun.texi,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -b -r1.27 -r1.28
--- doc/gnun.texi       21 Oct 2011 11:46:05 -0000      1.27
+++ doc/gnun.texi       13 Nov 2011 11:19:03 -0000      1.28
@@ -344,7 +344,8 @@
 prepared to check the CVS history of the original article.
 
 @item
-The official build is invoked thrice daily, because doing it more often
+The official build is invoked thrice address@hidden ``no-grace''
+items are rebuilt hourly.}, because doing it more often
 will potentially generate more messages to the mailing list in the form
 of commit notifications.  This has its drawback, since translators have
 to wait 12 hours until their PO files are updated, and another period
@@ -557,6 +558,7 @@
 @cindex fuzzy strings
 @cindex grace period
 @cindex deferred generation of articles
address@hidden
 @item address@hidden
 If defined, ordinary articles that have fuzzy strings and are not older
 than @var{days} will not be regenerated.  This functionality is
@@ -568,6 +570,12 @@
 variable has no effect on the homepage, the server templates, gnunews
 and all articles defined in the variable @code{no-grace-articles}.
 
address@hidden OUTDATED-GRACE
address@hidden address@hidden
+Grace period for out-of-date notice.  When the variable @code{GRACE} is
+defined, @code{OUTDATED-GRACE} defaults to 60 days
+(@pxref{GRACE,,grace period}).
+
 @cindex TEAM
 @cindex variable, team
 @item address@hidden
@@ -619,6 +627,8 @@
 specific and already defined, one way or another.
 
 @menu
+* no-grace-items::
+* update-localized-urls::
 * sync::
 * report::
 * triggers::
@@ -626,6 +636,27 @@
 * distclean::
 @end menu
 
address@hidden no-grace-items
address@hidden The @code{no-grace-items} target
+
+The @code{no-grace-items} target regenerates a limited set of articles
+that are not affected by grace period, namely, the homepage, the server
+templates, gnunews, all articles defined in the variable
address@hidden, and their staged copies (@pxref{GRACE,,grace
+period}).
+
+This target can be rebuilt more often than ``all''; it is invoked
+hourly.
+
address@hidden update-localized-urls
address@hidden The @code{update-localized-urls} target
+
+The @code{update-localized-urls} target invokes a script that generates
+the @file{localized-urls.mk} file.  This file includes the list
+of extracted from HTML comments (@pxref{Localized URLs}).
+
+This target is meant to be rebuilt nightly.
+
 @node sync
 @subsubsection The @code{sync} target
 @cindex synchronization, repository
@@ -795,11 +826,13 @@
 @emph{if and only if} you have all the SSI templates translated, and
 have already committed in the repository all these template files:
 @file{server/@/po/@/address@hidden,
address@hidden/@/po/@/address@hidden,
 @file{server/@/po/@/address@hidden,
 @file{server/@/po/@/address@hidden,
 @file{server/@/po/@/address@hidden, as well as the templates
 that are not under GNUN's control and are translated manually, like
 @file{server/address@hidden,
address@hidden/address@hidden,
 @file{server/address@hidden and
 @file{server/address@hidden
 
@@ -908,6 +941,7 @@
 * PO Tips::             Tips and hints for translators.
 * generic.LANG.html::   Specifying information that will propagate in
                           every translation in a certain language.
+* languages.txt::       Specifying canonical names for languages.
 * PO Files and Team::   How to maintain translations in the team's
                           repository.
 @end menu
@@ -1398,6 +1432,41 @@
 @address@hidden, including the homepage), will be modified to
 include the contents of this special file.
 
address@hidden languages.txt
address@hidden The @file{languages.txt} file
+
+The file @file{server/gnun/languages.txt} is used when generating lists
+of translations; those lists are subsequently included in all
+translations of the article.  Every line in file is either comment (when
+it begins with ``#'') or a definition for a language.  A language is
+defined by three tab-separated fields.  The first field defines the
+language suffix; it is used in file names and in texts of the links; The
+second field is the name of the language in English; it is used in HTML
+comments.  The third field defines the name of the language in that
+language itself; it is used in texts of the links, and it should be in
+UTF-8.  For example:
+
address@hidden
+de     German  Deutsch
address@hidden example
+
+The generated list of translations may look like this:
+
address@hidden
+<!-- begin translinks file -->
+<div id="translations">
+<ul class="translations-list">
+<!-- German -->
+<li><a href="/distros/screenshot.de.html">Deutsch</a>&nbsp;[de]</li>
+<!-- English -->
+<li><a href="/distros/screenshot.html">English</a>&nbsp;[en]</li>
+<!-- Polish -->
+<li><a href="/distros/screenshot.pl.html">polski</a>&nbsp;[pl]</li>
+</ul>
+</div> <!-- id="translations" -->
+<!-- end translinks file -->
address@hidden example
+
 @node PO Files and Team
 @subsection Maintaining Translations in Your Team's Repository
 @cindex project repository
@@ -1663,6 +1732,13 @@
 @section Tips and Hints for Webmasters
 @cindex tips, webmasters
 @cindex webmaster tips
address@hidden
+* Validation::                How to verify the documents.
+* Comments for Translators::  Passing commens to translators.
+* Modifying Boilerplates::
+* Localized URLs::            Specifying URLs of diagrams
+                                to be transated.
address@hidden menu
 
 This section contains some tips and general recommendations for
 webmasters in no particular order---it is not mandatory to follow them,
@@ -1679,15 +1755,8 @@
 update it immediately won't be disappointed if it changes again in the
 next run.
 
-Use @emph{only} US-ASCII characters and HTML entities for the others.
-This is required because the English text in the articles serves as a
-replacement of the translation when the latter is not complete.  So if
-you use, say, the character @'e (e-acute) directly in an English
-page---which is UTF-8 as declared in @file{server/head-include-1.html},
-it will appear broken on those translated pages who use a different
-encoding.  This specific advice is pretty much mandatory---the build
-fails if the original article contains such characters---but we are
-ready to fix any errors a webmaster makes.
address@hidden Validation
address@hidden Validation
 
 The script @command{gnun-validate-html} is useful for webmasters who
 want to verify if their (potentially intrusive) changes result in a
@@ -1700,6 +1769,10 @@
 
 @xref{gnun-validate-html}, for more information.
 
address@hidden Comments for Translators
address@hidden Comments for Translators
address@hidden comments for translators
+
 @c Emacs Lisp code goes here...
 
 If you want a comment to be visible for translators, place it
@@ -1726,6 +1799,10 @@
 after the beginning of the HTML comment (@code{<!--}), since this will
 unnecessarily indent the comment in the POT.
 
address@hidden Modifying Boilerplates
address@hidden Modifying Boilerplates
address@hidden boilerplates
+
 @strong{Warning:} Any structural diversion from @file{boilerplate.html}
 in a specific article is likely to result in errors from GNUN.  Any
 unexpected updates to the server templates (such as changing the entire
@@ -1734,6 +1811,35 @@
 such changes should not happen---only that they must be applied in our
 sandbox first, to ensure a smooth transition.
 
address@hidden Localized URLs
address@hidden Localized URLs
address@hidden localized URLs
+
+Some articles may contain diagrams or other images with English text
+that can and should be translated.  In order to make the translated
+versions appear in the respective translations, GNUN should be told
+what URLs need localization.  It can be done with HTML comments like
+
address@hidden
+<!-- GNUN: localize URL /philosophy/category.png,
+ /licenses/template-diagram.png and /graphics/jesus-cartoon.jpg -->
address@hidden example
+
+(One trailing comma is removed; if the URL contains no dot, it is
+ignored; the URLs are separated with spaces.)
+
+Such comments will be extracted nightly and complied into per-article
+lists of URLs.
+
+After every build GNUN will check if the respective
address@hidden/address@hidden and other files are present in
+the working copy and substitute the strings in the HTML file of the
+traslation.
+
+GNUN relies on URLs being absolute, starting from the root homepage
+as required in 
address@hidden://www.gnu.org/server/fsf-html-style-sheet.html#FilenameAndURLGuidelines}.
+
 @node Internals
 @chapter Unexciting Information for GNUN's Operation
 
@@ -1843,8 +1949,8 @@
 automatic variable is not expanded properly due to a bug in the
 makefile).
 
-The top of the working directory can be specified through --root option;
-the default value is ``../..''.
+The top of the working directory can be specified through @code{--root}
+option; the default value is ``../..''.
 
 @node mailfail
 @subsection The @command{mailfail} Script

Index: doc/web-trans.texi
===================================================================
RCS file: /sources/trans-coord/trans-coord/gnun/server/gnun/doc/web-trans.texi,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -b -r1.17 -r1.18
--- doc/web-trans.texi  12 Nov 2011 19:54:55 -0000      1.17
+++ doc/web-trans.texi  13 Nov 2011 11:19:03 -0000      1.18
@@ -1236,6 +1236,11 @@
 declared in the @code{<meta>} element at
 @file{server/address@hidden, so browsers will obey it.
 
+The encoding should be UTF-8.  This is required because the English text
+in the articles serves as a replacement of the translation when the latter
+is not complete, and because all translated pages share automatically
+generated lists of translations.
+
 @item server/html5-header.html
 This file is included in newer pages using some entities introduced
 in HTML5 draft.  We have to distinguish those pages since some features

Index: update-localized-urls
===================================================================
RCS file: update-localized-urls
diff -N update-localized-urls
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ update-localized-urls       13 Nov 2011 11:19:03 -0000      1.1
@@ -0,0 +1,125 @@
+#! /bin/bash
+
+# Copyright (C) 2011 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/>.
+
+# Regenerate lists for localized URLs.
+
+function version () {
+cat <<EOF
+update-localized-urls  (GNUnited Nations) 0.4
+Copyright (C) 2011 Free Software Foundation, Inc.
+You may redistribute copies of GNUnited Nations
+under the terms of the GNU General Public License.
+For more information about these matters, see the file named COPYING.
+EOF
+}
+
+function usage () {
+cat <<'EOF'
+Usage: update-localized-urls OPTION...
+
+Options:
+      --root=DIRECTORY       Specify top directory for working copy
+                             (`../..' by default)
+  -o, --output=FILE          Specify output file
+                             (`localized-urls.mk' by default)
+      --version              Display version info and exit
+      --help                 Display this help and exit
+
+Report bugs to address@hidden
+GNUnited Nations home page: <http://www.gnu.org/software/gnun/>
+General help using GNU software: <http://www.gnu.org/gethelp/>
+EOF
+}
+
+params=$#
+ROOT=../..
+OUTPUT=localized-urls.mk
+
+while [ ${params} -gt 1 ]; do
+  case "$1" in
+      --help )
+         usage
+         exit 0
+         ;;
+      --version )
+         version
+         exit 0
+         ;;
+      --root )
+         shift
+         params=$((${params}-1))
+         ROOT="$1"
+         ;;
+      --root=* )
+         ROOT="${1#--root=}"
+         ;;
+      --output | -o )
+         shift
+         params=$((${params}-1))
+         OUTPUT="$1"
+         ;;
+      --output=* )
+         OUTPUT="${1#--output=}"
+         ;;
+      * )
+          echo 1>&2 Error: unknown option ${1}
+          usage
+          exit 1;
+         ;;
+  esac
+  params=$((${params}-1))
+  shift
+done
+
+if ! test -d "${ROOT}"; then
+  echo 1>&2 Error: root directory "'"${ROOT}"'" not found
+  exit 1;
+fi
+
+TMP=$(mktemp urls.XXXXXXXXXX)
+trap "rm -f ${TMP}" EXIT
+
+cat > ${TMP} <<EOF
+# Generated by GNUN (update-localized-urls) on $(date)
+
+localized-url-sources :=
+EOF
+find ${ROOT} -type f -name \*.pot -print \
+  | while read pot; do
+      article=${pot##*/}; article=${article%.pot};
+      html_base=${pot%/po/*}/${article}
+      html=${html_base}.html
+      html_base=${html_base#${ROOT}/}
+      test -f ${html} || continue
+      urls="$(sed -n '
+/<!-- GNUN: localize URL/ {
+ :egin; / -->/! { N; begin;}
+ s/[[:space:]]\+/ /g; s/, / /g;
+ s%.*<!-- GNUN: localize URL \+\(.*\) \+-->.*%\1%
+ s/ [^.]\+ / /g; p;
+}' ${html})"
+      test -n "${urls}" || continue
+      cat >> ${TMP} <<EOF
+localized-url-sources += ${html_base}
+define ${html_base}-localized-urls
+$(echo ${urls} | sed 's/ / \\\n/g;')
+endef
+EOF
+  done
+cp ${TMP} ${OUTPUT}

Index: update-localized-urls.in
===================================================================
RCS file: update-localized-urls.in
diff -N update-localized-urls.in
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ update-localized-urls.in    13 Nov 2011 11:19:03 -0000      1.1
@@ -0,0 +1,125 @@
+#! /bin/bash
+
+# Copyright (C) 2011 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/>.
+
+# Regenerate lists for localized URLs.
+
+function version () {
+cat <<EOF
+update-localized-urls (@PACKAGE_NAME@) @PACKAGE_VERSION@
+Copyright (C) 2011 Free Software Foundation, Inc.
+You may redistribute copies of @PACKAGE_NAME@
+under the terms of the GNU General Public License.
+For more information about these matters, see the file named COPYING.
+EOF
+}
+
+function usage () {
+cat <<'EOF'
+Usage: update-localized-urls OPTION...
+
+Options:
+      --root=DIRECTORY       Specify top directory for working copy
+                             (`../..' by default)
+  -o, --output=FILE          Specify output file
+                             (`localized-urls.mk' by default)
+      --version              Display version info and exit
+      --help                 Display this help and exit
+
+Report bugs to @PACKAGE_BUGREPORT@
address@hidden@ home page: <@PACKAGE_URL@>
+General help using GNU software: <http://www.gnu.org/gethelp/>
+EOF
+}
+
+params=$#
+ROOT=../..
+OUTPUT=localized-urls.mk
+
+while [ ${params} -gt 1 ]; do
+  case "$1" in
+      --help )
+         usage
+         exit 0
+         ;;
+      --version )
+         version
+         exit 0
+         ;;
+      --root )
+         shift
+         params=$((${params}-1))
+         ROOT="$1"
+         ;;
+      --root=* )
+         ROOT="${1#--root=}"
+         ;;
+      --output | -o )
+         shift
+         params=$((${params}-1))
+         OUTPUT="$1"
+         ;;
+      --output=* )
+         OUTPUT="${1#--output=}"
+         ;;
+      * )
+          echo 1>&2 Error: unknown option ${1}
+          usage
+          exit 1;
+         ;;
+  esac
+  params=$((${params}-1))
+  shift
+done
+
+if ! test -d "${ROOT}"; then
+  echo 1>&2 Error: root directory "'"${ROOT}"'" not found
+  exit 1;
+fi
+
+TMP=$(mktemp urls.XXXXXXXXXX)
+trap "rm -f ${TMP}" EXIT
+
+cat > ${TMP} <<EOF
+# Generated by GNUN (update-localized-urls) on $(date)
+
+localized-url-sources :=
+EOF
+find ${ROOT} -type f -name \*.pot -print \
+  | while read pot; do
+      article=${pot##*/}; article=${article%.pot};
+      html_base=${pot%/po/*}/${article}
+      html=${html_base}.html
+      html_base=${html_base#${ROOT}/}
+      test -f ${html} || continue
+      urls="$(@SED@ -n '
+/<!-- GNUN: localize URL/ {
+ :egin; / -->/! { N; begin;}
+ s/[[:space:]]\+/ /g; s/, / /g;
+ s%.*<!-- GNUN: localize URL \+\(.*\) \+-->.*%\1%
+ s/ [^.]\+ / /g; p;
+}' ${html})"
+      test -n "${urls}" || continue
+      cat >> ${TMP} <<EOF
+localized-url-sources += ${html_base}
+define ${html_base}-localized-urls
+$(echo ${urls} | @SED@ 's/ / \\\n/g;')
+endef
+EOF
+  done
+cp ${TMP} ${OUTPUT}



reply via email to

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