From: John Mandereau Date: Mon, 3 Sep 2007 13:52:28 +0000 (+0200) Subject: Fix translation infrastructure X-Git-Tag: release/2.11.33-1~4^2~12^2~47 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=0ff196c31a0ab52f503614ca3c4ebf0189fe1063;p=lilypond.git Fix translation infrastructure The fixes in html-gettext are very ugly, but I'm sick and tired of fuzzing with regular expressions for cheating with node names. I'm not sure all this dirty trickery works, I'm going to contact Texinfo developers for feature requests, so we can get rid of this mess of Python and Gettext. --- diff --git a/buildscripts/html-gettext.py b/buildscripts/html-gettext.py index 702b1872c3..65efe8f283 100644 --- a/buildscripts/html-gettext.py +++ b/buildscripts/html-gettext.py @@ -36,10 +36,13 @@ html2texi = {'command': (re.compile (r'(.*?)< texi2html = {'command': (re.compile (r'@command{(.*?)}'), r'\1'), 'code': (re.compile (r'@code{(.*?)}'), r'\1') } +whitespaces = re.compile (r'\s+') + def _ (s): if not s: return '' + s = whitespaces.sub (' ', s) for c in html_codes: s = s.replace (c[1], c[0]) for u in html2texi.values(): @@ -74,8 +77,8 @@ def h_gettext (m): return '' + s +\ m.group(4) + _(m.group(5)) + '' -def rglos_gettext (m): - return '' + _(m.group(2)) + '' +def crossmanual_ref_gettext (m): + return '' + _(m.group(2)) + '' for filename in args[3:]: f = open (filename, 'r') @@ -84,9 +87,11 @@ for filename in args[3:]: page = re.sub (r'', link_gettext, page) page = re.sub (r'([^<]*?) - ([^<]*?)', title_gettext, page) # ugh - page = re.sub (r')()?(Appendix )?([A-Z\d.]+ |)(.+?)(?(3)):?', a_href_gettext, page) + page = re.sub (r'(?ms))()?(Appendix )?([A-Z\d.]+ |)(.+?)(?(3)):?', a_href_gettext, page) page = re.sub (r'(Appendix |)([A-Z\d.]+ |)?([^<]+)', h_gettext, page) - page = re.sub (r'(.+?)', rglos_gettext, page) + page = re.sub (r'(.+?)', crossmanual_ref_gettext, page) + # this is necessary for entries not translated by a_href_gettext + page = re.sub (r'(.+?)', crossmanual_ref_gettext, page) for w in ('Next:', 'Previous:', 'Up:'): page = re.sub (w, _(w), page) page = langdefs.LANGDICT[lang].html_filter (page) diff --git a/buildscripts/texi-gettext.py b/buildscripts/texi-gettext.py index 00807407b0..2c99352666 100644 --- a/buildscripts/texi-gettext.py +++ b/buildscripts/texi-gettext.py @@ -32,7 +32,7 @@ _doc = t.gettext include_re = re.compile (r'@include ((?!lily-).*?)\.texi$', re.M) whitespaces = re.compile (r'\s+') -ref_re = re.compile (r'(?ms)@(rglos|ref)(\{)(.*?)(\})') +ref_re = re.compile (r'(?ms)@(rglos|ruser|rprogram|ref)(\{)(.*?)(\})') node_section_re = re.compile (r'@(node|(?:unnumbered|appendix)(?:(?:sub){0,2}sec)?|top|chapter|(?:sub){0,2}section|(?:major|chap|(?:sub){0,2})heading)( )(.*?)(\n)') menu_entry_re = re.compile (r'\* (.*?)::')