Generate LINGUAS at buildtime and recognize LINGUAS variable

This commit is contained in:
Christian Dywan 2010-01-16 07:46:58 +01:00
parent 2d8c8bebf5
commit c335bb19c7
4 changed files with 20 additions and 6 deletions

1
.gitignore vendored
View file

@ -5,6 +5,7 @@ Makefile
_build_
po/.intltool-merge-cache
po/LINGUAS
po/POTFILES
po/midori.pot
po/stamp-it

View file

@ -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

View file

@ -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

20
wscript
View file

@ -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')