txt-to-html:
$(PYTHON) $(step-bindir)/text2html.py $(OUT_TXT_FILES)
+po-update:
+ make -C po po-update
+
ifneq ($(ISOLANG),)
new-lang:
@if (( $$(file -b $(ISOLANG)) == directory )) 2>/dev/null; \
cp fr/GNUmakefile $(ISOLANG)
cp fr/user/GNUmakefile $(ISOLANG)/user
sed -i -e 's/ISOLANG *= *fr/ISOLANG = $(ISOLANG)/' $(ISOLANG)/GNUmakefile $(ISOLANG)/user/GNUmakefile
- $(PYTHON) $(buildscript-dir)/texi-langutils.py -d $(outdir) -b "UNTRANSLATED NODE: IGNORE ME" -o doc.pot --skeleton --gettext ../user/lilypond.tely
+ $(PYTHON) $(buildscript-dir)/texi-langutils.py -d $(outdir) -b "UNTRANSLATED NODE: IGNORE ME" -l $(ISOLANG) -o doc.pot --skeleton --gettext ../user/lilypond.tely
mv $(outdir)/*.*tely $(ISOLANG)/user
msgmerge -U po/lilypond-doc.pot $(outdir)/doc.pot
cp po/lilypond-doc.pot po/$(ISOLANG).po
check-translation:
find $(ISOLANG)/user/ -name '*.*tely' | xargs $(PYTHON) $(buildscript-dir)/check_translation.py $(buildscript-dir)
+
+skeleton-update:
+ $(PYTHON) $(buildscript-dir)/texi-langutils.py -d $(outdir) -b "UNTRANSLATED NODE: IGNORE ME" -l $(ISOLANG) --skeleton ../user/lilypond.tely
+ $(PYTHON) $(buildscript-dir)/texi-skeleton-update.py $(ISOLANG)/user $(outdir)
endif
import re
import getopt
import os
-import string
-optlist, texi_files = getopt.getopt(sys.argv[1:],'no:d:b:i:',['skeleton', 'gettext'])
+def read_pipe (command):
+ print command
+ pipe = os.popen (command)
+ output = pipe.read ()
+ if pipe.close ():
+ print "pipe failed: %(command)s" % locals ()
+ return output
+
+
+optlist, texi_files = getopt.getopt(sys.argv[1:],'no:d:b:i:l:',['skeleton', 'gettext'])
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
output_file = 'doc.pot'
node_blurb = ''
-intro_blurb = ''
+doclang = ''
+topfile = os.path.basename (texi_files[0])
+head_committish = read_pipe ('git-rev-parse HEAD')
+intro_blurb = '''@c -*- coding: utf-8; mode: texinfo%(doclang)s -*-
+@c This file is part of %(topfile)s
+@ignore
+ Translation of GIT committish: %(head_committish)s
+
+ When revising a translation, copy the HEAD committish of the
+ version that you are working on. See TRANSLATION for details.
+@end ignore
+'''
+
+end_blurb = """
+-- SKELETON FILE --
+When you actually translate this file, please remove these lines as
+well as all `UNTRANSLATED NODE: IGNORE ME' lines.
+"""
for x in optlist:
if x[0] == '-o': # -o NAME set PO output file name to NAME
node_blurb = x[1]
elif x[0] == '-i': # -i BLURB set blurb written at beginning of each file to BLURB
intro_blurb = x[1]
+ elif x[0] == '-l': # -l ISOLANG set documentlanguage to ISOLANG
+ doclang = '; documentlanguage: ' + x[1]
+
+
+intro_blurb = intro_blurb % vars()
+
def process_texi (texifilename, i_blurb, n_blurb, write_skeleton, output_file=None):
try:
if output_file:
output_file.write ('_("' + item[3].strip () + '") # @' + item[2] + \
' in ' + texifilename + '\n')
- node_trigger = True
+ if item[2] == 'node':
+ node_trigger = True
elif item[2] == 'include':
includes.append(item[3])
+ g.write (end_blurb)
g.close ()
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) *([^@
--- /dev/null
+#!@PYTHON@
+# texi-skeleton-update.py
+
+import sys
+import glob
+import os
+import shutil
+
+sys.stderr.write ('texi-skeleton-update.py\n')
+
+orig_skeletons = set ([os.path.basename (f) for f in glob.glob (sys.argv[1] + '/*.itely')])
+new_skeletons = set ([os.path.basename (f) for f in glob.glob (sys.argv[2] + '/*.itely')])
+
+for f in new_skeletons:
+ if f in orig_skeletons:
+ g = open (os.path.join (sys.argv[1], f), 'r').read ()
+ if '-- SKELETON FILE --' in g:
+ sys.stderr.write ("Copying %s...\n" % f)
+ shutil.copy (os.path.join (sys.argv[2], f), sys.argv[1])
+ else:
+ sys.stderr.write ("Copying new file %s...\n" % f)
+ shutil.copy (os.path.join (sys.argv[2], f), sys.argv[1])
+
+for f in orig_skeletons.difference (new_skeletons):
+ sys.stderr.write ("Warning: outdated skeleton file %s\n" % f)