[Xfce4-commits] <midori:master> Generate LINGUAS at buildtime and recognize LINGUAS variable

Christian Dywan noreply at xfce.org
Sun Jan 17 18:16:03 CET 2010


Updating branch refs/heads/master
         to c335bb19c7b76933ace665aad891429a3a0afb5a (commit)
       from 2d8c8bebf57f9a8f6aaa0a52ca98a1620918bac8 (commit)

commit c335bb19c7b76933ace665aad891429a3a0afb5a
Author: Christian Dywan <christian at twotoasts.de>
Date:   Sat Jan 16 07:46:58 2010 +0100

    Generate LINGUAS at buildtime and recognize LINGUAS variable

 .gitignore |    1 +
 TRANSLATE  |    3 ---
 po/LINGUAS |    2 --
 wscript    |   20 +++++++++++++++++++-
 4 files changed, 20 insertions(+), 6 deletions(-)

diff --git a/.gitignore b/.gitignore
index d140ddc..60e4fc2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,6 +5,7 @@ Makefile
 _build_
 
 po/.intltool-merge-cache
+po/LINGUAS
 po/POTFILES
 po/midori.pot
 po/stamp-it
diff --git a/TRANSLATE b/TRANSLATE
index e642ec1..3b7a4d7 100644
--- a/TRANSLATE
+++ b/TRANSLATE
@@ -21,9 +21,6 @@ cd po
 msginit -l aa_CC -o aa.po -i midori.pot
 sed -i 's/PACKAGE/midori/g' aa.po
 
-Make sure you add your language to the file po/LINGUAS.
-Just open the file with a text editor and add your code.
-
 To check your language 'aa' for errors, do this:
 
 msgfmt -c --check-accelerators=_ aa.po
diff --git a/po/LINGUAS b/po/LINGUAS
deleted file mode 100644
index 47ec147..0000000
--- a/po/LINGUAS
+++ /dev/null
@@ -1,2 +0,0 @@
-# set of available languages (in alphabetic order)
-ast ca cs da de el en_GB es et fi fr gl he hu id it ja ko nl no pl pt pt_BR ro ru sk sr sr at latin sv tr uk zh_CN zh_TW
diff --git a/wscript b/wscript
index 0ecb48d..048de9b 100644
--- a/wscript
+++ b/wscript
@@ -20,7 +20,7 @@ import pproc as subprocess
 import os
 import UnitTest
 import Task
-from TaskGen import extension
+from TaskGen import extension, feature, taskgen
 import misc
 
 major = 0
@@ -245,6 +245,7 @@ def configure (conf):
     if 'CC' in os.environ: conf.env['CC'] = os.environ['CC'].split()
     conf.env['addons'] = option_enabled ('addons')
     conf.env['docs'] = option_enabled ('docs')
+    if 'LINGUAS' in os.environ: conf.env['LINGUAS'] = os.environ['LINGUAS']
 
     conf.check (header_name='unistd.h')
     if not conf.env['HAVE_UNIQUE']:
@@ -363,6 +364,21 @@ def set_options (opt):
     opt.add_option ('--build', help='Ignored')
     opt.add_option ('--disable-maintainer-mode', help='Ignored')
 
+# Taken from Geany's wscript, modified to support LINGUAS variable
+def write_linguas_file (self):
+    linguas = ''
+    if 'LINGUAS' in Build.bld.env:
+        linguas = Build.bld.env['LINGUAS']
+    else:
+        files = os.listdir ('../po')
+        for f in files:
+            if f.endswith ('.po'):
+                linguas += '%s ' % f[:-3]
+    f = open ('../po/LINGUAS', 'w')
+    f.write ('# This file is autogenerated. Do not edit.\n%s\n' % linguas)
+    f.close ()
+write_linguas_file = feature ('intltool_po')(write_linguas_file)
+
 def build (bld):
     def image_to_win32ico (task):
         'Converts an image to a Win32 ico'
@@ -498,6 +514,8 @@ def build (bld):
         distclean ()
 
 def distclean ():
+    if os.path.exists ('po/LINGUAS'):
+        os.remove ('po/LINGUAS')
     if os.path.exists ('po/midori.pot'):
         os.remove ('po/midori.pot')
 



More information about the Xfce4-commits mailing list