]> git.donarmstrong.com Git - lilypond.git/blobdiff - buildscripts/www_post.py
Rewrites for Staff; thanks Eyolf!
[lilypond.git] / buildscripts / www_post.py
index 09ae7b80fb42f67929bfea59d0ad7e67a285b0b0..a61c75961bf29a08992c4c565eeb8f3a9a384ef4 100644 (file)
@@ -9,25 +9,30 @@
 import sys
 import os
 import re
+import gettext
 
-package_name, package_version, buildscript_dir, outdir, targets = sys.argv[1:]
+package_name, package_version, buildscript_dir, localedir, outdir, targets = sys.argv[1:]
 targets = targets.split (' ')
 outdir = os.path.normpath (outdir)
 doc_dirs = ['input', 'Documentation', outdir]
 target_pattern = os.path.join (outdir, '%s-root')
 
 static_files = {
-    # ugly hack: the following overwrites HTML Info dir with a link to
-    # the (more useful) documentation index
-    os.path.join ('Documentation/user', outdir, 'index.html'):
-    '''<META HTTP-EQUIV="refresh" content="0;URL=../index.html">
-<html><body>Redirecting to the documentation index...</body></html>\n''',
     os.path.join (outdir, 'index.html'):
     '''<META HTTP-EQUIV="refresh" content="0;URL=Documentation/index.html">
 <html><body>Redirecting to the documentation index...</body></html>\n''',
     os.path.join (outdir, 'VERSION'):
     package_version + '\n' }
 
+import langdefs
+
+# ugly hack: the following overwrites HTML Info dir with a link to
+# the (more useful) documentation index
+for l in langdefs.LANGUAGES:
+    static_files[os.path.join ('Documentation/user', outdir, l.file_name ('index', '.html'))] = \
+                                  '<META HTTP-EQUIV="refresh" content="0;URL=../' + l.file_name ('index', '.html') + \
+                                  '">\n<html><body>Redirecting to the documentation index...</body></html>\n'
+
 for f, contents in static_files.items ():
     open (f, 'w').write (contents)
 
@@ -35,7 +40,6 @@ for f, contents in static_files.items ():
 sys.path.append (buildscript_dir)
 import mirrortree
 import add_html_footer
-import langdefs
 
 sys.stderr.write ("Mirrorring...\n")
 dirs, symlinks, files = mirrortree.walk_tree (
@@ -78,10 +82,17 @@ if 'online' in targets:
     f.write ('#.htaccess\nDirectoryIndex index\n')
     f.close ()
 
+# load gettext messages catalogs
+translation = {}
+for l in langdefs.LANGUAGES:
+    if l.enabled and l.code != 'en':
+        translation[l.code] = gettext.translation('lilypond-doc', localedir, [l.code]).gettext
+
 add_html_footer.build_pages_dict (html_files)
 for t in targets:
     sys.stderr.write ("Processing HTML pages for %s target...\n" % t)
     add_html_footer.add_html_footer (
+        translation = translation,
         package_name = package_name,
         package_version = package_version,
         target = t,