From: Christian Dywan Date: Sat, 16 Jan 2010 06:46:58 +0000 (+0100) Subject: Generate LINGUAS at buildtime and recognize LINGUAS variable X-Git-Url: https://spindle.queued.net/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c335bb19c7b76933ace665aad891429a3a0afb5a;p=midori Generate LINGUAS at buildtime and recognize LINGUAS variable --- diff --git a/.gitignore b/.gitignore index d140ddc6..60e4fc21 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 e642ec1a..3b7a4d73 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 47ec147d..00000000 --- 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@latin sv tr uk zh_CN zh_TW diff --git a/wscript b/wscript index 0ecb48d7..048de9b1 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')