From: John Mandereau Date: Tue, 6 Feb 2007 18:42:45 +0000 (+0100) Subject: Process @rglos like @node in translated user manual X-Git-Tag: release/2.11.18-1~5^2~6^2^2~14 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=2208ffc39db9da413fa7ac2c6dd8dfd7c3348e13;p=lilypond.git Process @rglos like @node in translated user manual --- diff --git a/buildscripts/html-gettext.py b/buildscripts/html-gettext.py index 3f401382ae..4583d37c5d 100644 --- a/buildscripts/html-gettext.py +++ b/buildscripts/html-gettext.py @@ -58,6 +58,9 @@ def h_gettext (m): return '' + \ m.group(3) + _(m.group(4)) + '' +def rglos_gettext (m): + return '' + _(m.group(2)) + '' + for filename in args[3:]: f = open (filename, 'r') page = f.read () @@ -66,6 +69,7 @@ for filename in args[3:]: page = re.sub (r'([^<]*?) - ([^<]*?)', title_gettext, page) page = re.sub (r')((?:|)(?:[\d.]+ |))([^<]+)(|)(:)?', a_href_gettext, page) page = re.sub (r'([\d.]+ |)?([^<]+)', h_gettext, page) + page = re.sub (r'(.+?)', rglos_gettext, page) for w in ('Next:', 'Previous:', 'Up:'): page = re.sub (w, _(w), page) f = open (os.path.join (outdir, filename), 'w') diff --git a/buildscripts/texi-langutils.py b/buildscripts/texi-langutils.py index 62c87619dd..9f914008f7 100644 --- a/buildscripts/texi-langutils.py +++ b/buildscripts/texi-langutils.py @@ -31,7 +31,6 @@ for x in optlist: def process_texi (texifilename, i_blurb, n_blurb, write_skeleton, output_file=None): try: - #print "Processing %s..." % texifilename f = open (texifilename, 'r') texifile = f.read () f.close () @@ -43,11 +42,13 @@ def process_texi (texifilename, i_blurb, n_blurb, write_skeleton, output_file=No ]+)::[^ ]*?$|^@(include|menu|end menu|node|(?:unnumbered|appendix)(?:(?:sub){0,2}sec)?|top|chapter|(?:sub){0,2}section|(?:major|chap|(?:sub){0,2})heading) *([^@ ]*)[^ - ]*?$""", texifile, re.M) + ]*?$|@(rglos){(.+?)}""", texifile, re.M) node_trigger = False for item in tutu: if item[0] == '*': g.write ('* ' + item[1] + '::\n') + elif output_file and item[4] == 'rglos': + output_file.write ('_("' + item[5] + '") # @rglos in ' + texifilename + '\n') else: g.write ('@' + item[2] + ' ' + item[3] + '\n') if node_trigger: @@ -55,7 +56,8 @@ def process_texi (texifilename, i_blurb, n_blurb, write_skeleton, output_file=No node_trigger = False if not item[2] in ('include', 'menu', 'end menu'): if output_file: - output_file.write ('_("' + item[3].strip () + '")\n') + output_file.write ('_("' + item[3].strip () + '") # @' + item[2] + \ + ' in ' + texifilename + '\n') node_trigger = True elif item[2] == 'include': includes.append(item[3]) @@ -63,12 +65,14 @@ def process_texi (texifilename, i_blurb, n_blurb, write_skeleton, output_file=No elif output_file: toto = re.findall (r"""^@(include|node|(?:unnumbered|appendix)(?:(?:sub){0,2}sec)?|top|chapter|(?:sub){0,2}section|(?:major|chap|(?:sub){0,2})heading) *([^@ ]*)[^ - ]*?$""", texifile, re.M) + ]*?$|@(rglos){(.+?)}""", texifile, re.M) for item in toto: if item[0] == 'include': includes.append(item[1]) + elif item[2] == 'rglos': + output_file.write ('# @rglos in ' + texifilename + '\n_("' + item[3] + '")\n') else: - output_file.write ('_("' + item[1].strip () + '")\n') + output_file.write ('# @' + item[0] + ' in ' + texifilename + '\n_("' + item[1].strip () + '")\n') if process_includes: dir = os.path.dirname (texifilename) for item in includes: @@ -89,7 +93,7 @@ if make_gettext: for word in ('Up:', 'Next:', 'Previous:', 'Appendix', 'Footnotes'): node_list.write ('_("' + word + '")\n') node_list.close () - os.system ('xgettext -L Python --no-location -o ' + output_file + ' ' + node_list_filename) + os.system ('xgettext -c -L Python --no-location -o ' + output_file + ' ' + node_list_filename) else: for texi_file in texi_files: process_texi (texi_file, intro_blurb, node_blurb, make_skeleton)