]> git.donarmstrong.com Git - lilypond.git/commitdiff
Docs: add NO_COLOR/--no-color option to check-translation
authorJohn Mandereau <john.mandereau@gmail.com>
Wed, 24 Sep 2008 19:57:27 +0000 (21:57 +0200)
committerJohn Mandereau <john.mandereau@gmail.com>
Wed, 24 Sep 2008 19:59:47 +0000 (21:59 +0200)
Documentation/GNUmakefile
Documentation/TRANSLATION
buildscripts/check_translation.py

index 47c2b0a074eac36b2ed41e0c8acd45a0df0b5d11..2f99e82fd77c0ac53a88e1a3a1c00a818ddce9d8 100644 (file)
@@ -60,6 +60,10 @@ new-lang:
 
 CHECKED_FILES = $(ISOLANG)/index.html.in $(shell find $(ISOLANG)/user/ -maxdepth 1 -name '*.*te??')
 
+ifneq ($(NO_COLOR),)
+CHECK_TRANSLATION_FLAGS = --no-color
+endif
+
 TELY_FILES = $(call src-wildcard,$(ISOLANG)/user/*.tely)
 skeleton-update:
        $(PYTHON) $(buildscript-dir)/texi-langutils.py -d $(outdir) -l $(ISOLANG) --skeleton $(TELY_FILES:$(ISOLANG)/user/%.tely=../user/%.tely)
@@ -92,10 +96,10 @@ fix-xrefs:
        $(DOCUMENTS_INCLUDES) $(buildscript-dir)/manuals_definitions.py
 
 check-translation:
-       $(PYTHON) $(buildscript-dir)/check_translation.py $(CHECKED_FILES)
+       $(PYTHON) $(buildscript-dir)/check_translation.py $(CHECK_TRANSLATION_FLAGS) $(CHECKED_FILES)
 
 update-translation:
-       $(PYTHON) $(buildscript-dir)/check_translation.py --update $(CHECKED_FILES)
+       $(PYTHON) $(buildscript-dir)/check_translation.py --update $(CHECK_TRANSLATION_FLAGS) $(CHECKED_FILES)
 
 translation-status:
        make -C po out=www messages
index 43735766616242e3c8da4c1db3271edb90873fc0..7f6c97126b1963d889ce2aa424a6f5a44d5a0e74 100644 (file)
@@ -299,6 +299,11 @@ Small tip: to see only which files need to be updated, do
 
     make ISOLANG=<MY_LANGUAGE> check-translation | grep 'diff --git'
 
+To avoid printing terminal colors control characters, which is often
+desirable when you redirect output to a file, run
+
+    make ISOLANG=<MY_LANGUAGE> NO_COLOR=1 check-translation
+
 
 Global state of the translation is recorded in
 Documentation/translations.html.in, which is used to generate
index 887e7c210b18ff031397760cd4ec24ac2afb2345..4f6ef6a62908b8bcaff37d427416249cfcaa0f71 100755 (executable)
@@ -9,6 +9,7 @@ import langdefs
 import buildlib
 
 verbose = 0
+use_colors = False
 lang = 'C'
 C = lang
 
@@ -35,7 +36,7 @@ def do_file (file_name, lang_codes, buildlib):
     
     original = dir_lang (file_name, '', lang_dir_index)
     translated_contents = open (file_name).read ()
-    (diff_string, error) = buildlib.check_translated_doc (original, translated_contents, color=not update_mode)
+    (diff_string, error) = buildlib.check_translated_doc (original, translated_contents, color=use_colors and not update_mode)
 
     if error:
         sys.stderr.write ('warning: %s: %s' % (file_name, error))
@@ -62,7 +63,7 @@ This script is licensed under the GNU GPL.
 ''')
 
 def do_options ():
-    global lang, verbose, update_mode
+    global lang, verbose, update_mode, use_colors
 
     p = optparse.OptionParser (usage="check-translation [--language=LANG] [--verbose] FILE...",
                                description="This script is licensed under the GNU GPL.")
@@ -70,11 +71,16 @@ def do_options ():
                   action='store',
                   default='site',
                   dest="language")
+    p.add_option ("--no-color",
+                  action='store_false',
+                  default=True,
+                  dest="color",
+                  help="do not print ANSI-cooured output")
     p.add_option ("--verbose",
                   action='store_true',
                   default=False,
                   dest="verbose",
-                  help="the GIT directory to merge.")
+                  help="print details, including executed shell commands")
     p.add_option ('-u', "--update",
                   action='store_true',
                   default=False,
@@ -84,6 +90,7 @@ def do_options ():
     (options, files) = p.parse_args ()
     verbose = options.verbose
     lang = options.language
+    use_colors = options.color
     update_mode = options.update_mode
     
     return files