From dbad9a5ad3430ec0d7832f8854eb8cbb8195a6d8 Mon Sep 17 00:00:00 2001 From: John Mandereau Date: Tue, 19 Jan 2010 00:47:30 +0100 Subject: [PATCH] Docs: update translations script and instructions in the CG Also remove French docs unused file. --- Documentation/GNUmakefile | 3 +- Documentation/contributor/doc-work.itexi | 49 ++++++++++++++---------- Documentation/fr/dedication.itely | 18 --------- scripts/auxiliar/texi-langutils.py | 18 ++++++--- 4 files changed, 43 insertions(+), 45 deletions(-) delete mode 100644 Documentation/fr/dedication.itely diff --git a/Documentation/GNUmakefile b/Documentation/GNUmakefile index 528d660b52..50f3ff672f 100644 --- a/Documentation/GNUmakefile +++ b/Documentation/GNUmakefile @@ -267,11 +267,12 @@ new-lang: TRANSLATION_DIRS = web texidocs TRANSLATION_FILES = $(shell git ls-files $(ISOLANG) | grep -v GNUmakefile) +TEXI_LANGUTIL_FLAGS += --skeleton TELY_FILES = $(call src-wildcard,$(ISOLANG)/*.tely) skeleton-update: mkdir -p $(ISOLANG) - $(PYTHON) $(auxscript-dir)/texi-langutils.py -d $(outdir) -l $(ISOLANG) --skeleton $(TELY_FILES:$(ISOLANG)/%.tely=../%.tely) + $(PYTHON) $(auxscript-dir)/texi-langutils.py -d $(outdir) -l $(ISOLANG) $(TEXI_LANGUTIL_FLAGS) $(TELY_FILES:$(ISOLANG)/%.tely=../%.tely) $(PYTHON) $(auxscript-dir)/texi-skeleton-update.py $(ISOLANG) $(outdir) snippet-update: diff --git a/Documentation/contributor/doc-work.itexi b/Documentation/contributor/doc-work.itexi index 9d6497c664..67f23b5732 100644 --- a/Documentation/contributor/doc-work.itexi +++ b/Documentation/contributor/doc-work.itexi @@ -1280,9 +1280,8 @@ All files should be encoded in UTF-8. @menu * Files to be translated:: -* Translating the Learning Manual and other Texinfo documentation:: -* Translating the Notation Reference and Application Usage:: -* Translating the Documentation index index.html.in:: +* Translating the Web site and other Texinfo documentation:: +* Adding a Texinfo manual:: @end menu @node Files to be translated @@ -1290,8 +1289,8 @@ All files should be encoded in UTF-8. @include contributor/doc-translation-list.itexi -@node Translating the Learning Manual and other Texinfo documentation -@unnumberedsubsubsec Translating the Learning Manual and other Texinfo documentation +@node Translating the Web site and other Texinfo documentation +@unnumberedsubsubsec Translating the Web site and other Texinfo documentation @iftex @vskip 12pt @@ -1452,22 +1451,32 @@ and/or the Documentation Editors on @email{lilypond-devel@@gnu.org} list. -@node Translating the Notation Reference and Application Usage -@unnumberedsubsubsec Translating the Notation Reference and Application Usage +@node Adding a Texinfo manual +@unnumberedsubsubsec Adding a Texinfo manual -Copy @file{notation.tely} (or @file{application.tely}, -respectively) into @file{@var{MY-LANGUAGE}}, then translate this -file and run @code{skeleton-update} -- see @ref{Updating documentation -translation}. Your are now ready to translate the Notation Reference -(Application Usage, respectively) exactly like the Learning Manual. +In order to start translating a new manual whose basename is @var{FOO}, +do +@example +cd Documentation/@var{MY-LANGUAGE} +cp ../@var{FOO}.tely . +mkdir @var{FOO} +cp web/GNUmakefile @var{FOO} +@end example -@node Translating the Documentation index index.html.in -@unnumberedsubsubsec Translating the Documentation index @file{index.html.in} +@noindent +then append @var{FOO} to variable @code{SUBDIRS} in +Documentation/@var{MY-LANGUAGE}/GNUmakefile, then translate file +@var{MY-LANGUAGE}/@var{FOO}.tely and run @code{skeleton-update}: -Unlike almost all HTML pages in this documentation, links in this page -are not tweaked by @file{postprocess_html.py}, so links should be -manually edited to link to existing translations. +@example +cd Documentation/ +make ISOLANG=@var{MY-LANGUAGE} TEXI_LANGUTIL_FLAGS=--head-only skeleton-update +@end example + +@noindent +Your are now ready to translate the new manual exactly like the web site +or the Learning Manual. @node Documentation translation maintenance @@ -1562,9 +1571,9 @@ diff cannot be generated or is bigger than the file in English itself, the full file in English will be opened instead. Texinfo skeleton files, i.e. @file{.itely} files not yet translated, -containing only the Texinfo structure can be updated automatically: -whenever @command{make check-translation} shows that such files should -be updated, run from @file{Documentation/} +containing only the first node of the original file in English can be +updated automatically: whenever @command{make check-translation} shows +that such files should be updated, run from @file{Documentation/} @example make ISOLANG=@var{MY_LANGUAGE} skeleton-update diff --git a/Documentation/fr/dedication.itely b/Documentation/fr/dedication.itely deleted file mode 100644 index 15a76811e2..0000000000 --- a/Documentation/fr/dedication.itely +++ /dev/null @@ -1,18 +0,0 @@ -@c -*- coding: utf-8; mode: texinfo; documentlanguage: fr -*- - -@ignore - Translation of GIT committish: d56aa8181857c5feabf303ae88e716eba069f0a9 - - - When revising a translation, copy the HEAD committish of the - version that you are working on. See TRANSLATION for details. -@end ignore - -@c \version "2.12.0" - -@quotation -Nous souhaitons dédier ce programme à tous les amis que nous avons -rencontrés par la musique. - -Han-Wen et Jan -@end quotation diff --git a/scripts/auxiliar/texi-langutils.py b/scripts/auxiliar/texi-langutils.py index f35ebb8e73..d24f80313f 100755 --- a/scripts/auxiliar/texi-langutils.py +++ b/scripts/auxiliar/texi-langutils.py @@ -19,11 +19,12 @@ def read_pipe (command): return output -optlist, texi_files = getopt.getopt(sys.argv[1:],'no:d:b:i:l:',['skeleton', 'gettext']) +optlist, texi_files = getopt.getopt(sys.argv[1:],'no:d:b:i:l:',['skeleton', 'gettext', 'head-only']) process_includes = not ('-n', '') in optlist # -n don't process @include's in texinfo files make_gettext = ('--gettext', '') in optlist # --gettext generate a node list from a Texinfo source make_skeleton = ('--skeleton', '') in optlist # --skeleton extract the node tree from a Texinfo source +head_only = ('--head-only', '') in optlist # --head-only only write first node in included Texinfo skeletons output_name = 'doc.pot' @@ -59,7 +60,7 @@ for x in optlist: elif x[0] == '-l': # -l ISOLANG set documentlanguage to ISOLANG doclang = '; documentlanguage: ' + x[1] -texinfo_with_menus_re = re.compile (r"^(\*) +([^:\n]+)::.*?$|^@(afourpaper|author|bye|contents|copying|end copying|divClass|divEnd|divId|documentencoding|documentlanguage|finalout|ifnottex|end ifnottex|imageClickable|imageFloat|imageId|image|include|menu|end menu|node|quotation|end quotation|ref|rgloss|setfilename|settitle|set|(?:unnumbered|appendix)(?:(?:sub){0,2}sec)?|titlefont|titlepage|end titlepage|title|sourceimage|subtitle|top|vskip|chapter|(?:sub){0,2}section|(?:major|chap|(?:sub){0,2})heading|c) *(([^ \n].*)|$)", re.M) +texinfo_with_menus_re = re.compile (r"^(\*) +([^:\n]+)::.*?$|^@(include|menu|end menu|node|(?:unnumbered|appendix)(?:(?:sub){0,2}sec)?|top|chapter|(?:sub){0,2}section|(?:major|chap|(?:sub){0,2})heading) *(.*?)$|@(rglos){(.+?)}", re.M) texinfo_re = re.compile (r"^@(include|node|(?:unnumbered|appendix)(?:(?:sub){0,2}sec)?|top|chapter|(?:sub){0,2}section|(?:major|chap|(?:sub){0,2})heading) *(.+?)$|@(rglos){(.+?)}", re.M) @@ -67,7 +68,8 @@ ly_string_re = re.compile (r'^([a-zA-Z]+)[\t ]*=|%+[\t ]*(.*)$|\\(?:new|context) lsr_verbatim_ly_re = re.compile (r'% begin verbatim$') texinfo_verbatim_ly_re = re.compile (r'^@lilypond\[.*?verbatim') -def process_texi (texifilename, i_blurb, n_blurb, write_skeleton, topfile, output_file=None, scan_ly=False): +def process_texi (texifilename, i_blurb, n_blurb, write_skeleton, topfile, + output_file=None, scan_ly=False, inclusion_level=0): try: f = open (texifilename, 'r') texifile = f.read () @@ -131,6 +133,8 @@ def process_texi (texifilename, i_blurb, n_blurb, write_skeleton, topfile, outpu g.write ('@translationof ' + node_just_defined + '\n') g.write (n_blurb) node_just_defined = '' + if head_only and inclusion_level == 1: + break elif item[2] == 'include': includes.append (item[3]) else: @@ -139,7 +143,8 @@ def process_texi (texifilename, i_blurb, n_blurb, write_skeleton, topfile, outpu printedfilename + '\n_(r"' + item[3].strip () + '")\n') if item[2] == 'node': node_just_defined = item[3].strip () - g.write (end_blurb) + if not head_only: + g.write (end_blurb) g.close () elif output_file: @@ -152,10 +157,11 @@ def process_texi (texifilename, i_blurb, n_blurb, write_skeleton, topfile, outpu else: output_file.write ('# @' + item[0] + ' in ' + printedfilename + '\n_(r"' + item[1].strip () + '")\n') - if process_includes: + if process_includes and (not head_only or inclusion_level < 1): dir = os.path.dirname (texifilename) for item in includes: - process_texi (os.path.join (dir, item.strip ()), i_blurb, n_blurb, write_skeleton, topfile, output_file, scan_ly) + process_texi (os.path.join (dir, item.strip ()), i_blurb, n_blurb, + write_skeleton, topfile, output_file, scan_ly, inclusion_level + 1) except IOError, (errno, strerror): sys.stderr.write ("I/O error(%s): %s: %s\n" % (errno, texifilename, strerror)) -- 2.39.5