]> git.donarmstrong.com Git - lilypond.git/commitdiff
Add lilypond-book fragment option 'nogettext'
authorJohn Mandereau <john.mandereau@gmail.com>
Wed, 10 Dec 2008 19:49:19 +0000 (20:49 +0100)
committerJohn Mandereau <john.mandereau@gmail.com>
Wed, 10 Dec 2008 19:49:19 +0000 (20:49 +0100)
Documentation/user/lilypond-book.itely
scripts/lilypond-book.py

index f35bcb10223462a36c7d981eeb75a6b8084b4d99..0eaae36f6437de95350e9b77bf080689265a5a8d 100644 (file)
@@ -674,6 +674,13 @@ will be printed with a verbatim block like
   f2 e
 @end example
 
+@noindent
+If you would like to translate comments and variable names in verbatim
+output but not in the sources, you may set the environment variable
+@code{LYDOC_LOCALEDIR} to a directory path; the directory should
+contain a tree of @file{.mo} message catalogs with @code{lilypond-doc}
+as a domain.
+
 @item addversion
 (Only for Texinfo output.)  Prepend line @code{\version
 @@w@{"@@version@{@}"@}} to @code{verbatim} output.
@@ -740,6 +747,10 @@ Texinfo document as @code{@@lydoctitle @var{text}}.
 The same remark about @code{texidoc} processing with localized
 languages also applies to @code{doctitle}.
 
+@item nogettext
+(Only for Texinfo output.) Do not translate comments and variable
+names in the snippet quoted verbatim.
+
 @item printfilename
 If a LilyPond input file is included with @code{\lilypondfile}, print
 the file name right before the music snippet.  For HTML output, this
index 560f675de26d6ce4a4d6bb239e63614ec0f9c816..655ea9888e6945ea7a2d3fe25048460cd293249a 100644 (file)
@@ -253,6 +253,7 @@ LAYOUT = 'layout'
 LINE_WIDTH = 'line-width'
 LILYQUOTE = 'lilyquote'
 NOFRAGMENT = 'nofragment'
+NOGETTEXT = 'nogettext'
 NOINDENT = 'noindent'
 NOQUOTE = 'noquote'
 NORAGGED_RIGHT = 'noragged-right'
@@ -572,6 +573,7 @@ simple_options = [
     EXAMPLEINDENT,
     FRAGMENT,
     NOFRAGMENT,
+    NOGETTEXT,
     NOINDENT,
     PRINTFILENAME,
     DOCTITLE,
@@ -993,7 +995,10 @@ class LilypondSnippet (Snippet):
         self.do_options (os, self.type)
 
     def verb_ly (self):
-        return verb_ly_gettext (self.substring ('code'))
+        if NOGETTEXT in self.option_dict:
+            return self.substring ('code')
+        else:
+            return verb_ly_gettext (self.substring ('code'))
 
     def ly (self):
         contents = self.substring ('code')
@@ -1211,7 +1216,8 @@ class LilypondSnippet (Snippet):
         file (path + '.txt', 'w').write ('image of music')
 
     def relevant_contents (self, ly):
-        return re.sub (r'\\(version|sourcefileline|sourcefilename)[^\n]*\n', '', ly)
+        return re.sub (r'\\(version|sourcefileline|sourcefilename)[^\n]*\n|' +
+                       NOGETTEXT + '[,\]]', '', ly)
 
     def link_all_output_files (self, output_dir, output_dir_files, destination):
         existing, missing = self.all_output_files (output_dir, output_dir_files)