Generate LINGUAS at buildtime and recognize LINGUAS variable
This commit is contained in:
parent
2d8c8bebf5
commit
c335bb19c7
4 changed files with 20 additions and 6 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -5,6 +5,7 @@ Makefile
|
||||||
_build_
|
_build_
|
||||||
|
|
||||||
po/.intltool-merge-cache
|
po/.intltool-merge-cache
|
||||||
|
po/LINGUAS
|
||||||
po/POTFILES
|
po/POTFILES
|
||||||
po/midori.pot
|
po/midori.pot
|
||||||
po/stamp-it
|
po/stamp-it
|
||||||
|
|
|
@ -21,9 +21,6 @@ cd po
|
||||||
msginit -l aa_CC -o aa.po -i midori.pot
|
msginit -l aa_CC -o aa.po -i midori.pot
|
||||||
sed -i 's/PACKAGE/midori/g' aa.po
|
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:
|
To check your language 'aa' for errors, do this:
|
||||||
|
|
||||||
msgfmt -c --check-accelerators=_ aa.po
|
msgfmt -c --check-accelerators=_ aa.po
|
||||||
|
|
|
@ -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
20
wscript
|
@ -20,7 +20,7 @@ import pproc as subprocess
|
||||||
import os
|
import os
|
||||||
import UnitTest
|
import UnitTest
|
||||||
import Task
|
import Task
|
||||||
from TaskGen import extension
|
from TaskGen import extension, feature, taskgen
|
||||||
import misc
|
import misc
|
||||||
|
|
||||||
major = 0
|
major = 0
|
||||||
|
@ -245,6 +245,7 @@ def configure (conf):
|
||||||
if 'CC' in os.environ: conf.env['CC'] = os.environ['CC'].split()
|
if 'CC' in os.environ: conf.env['CC'] = os.environ['CC'].split()
|
||||||
conf.env['addons'] = option_enabled ('addons')
|
conf.env['addons'] = option_enabled ('addons')
|
||||||
conf.env['docs'] = option_enabled ('docs')
|
conf.env['docs'] = option_enabled ('docs')
|
||||||
|
if 'LINGUAS' in os.environ: conf.env['LINGUAS'] = os.environ['LINGUAS']
|
||||||
|
|
||||||
conf.check (header_name='unistd.h')
|
conf.check (header_name='unistd.h')
|
||||||
if not conf.env['HAVE_UNIQUE']:
|
if not conf.env['HAVE_UNIQUE']:
|
||||||
|
@ -363,6 +364,21 @@ def set_options (opt):
|
||||||
opt.add_option ('--build', help='Ignored')
|
opt.add_option ('--build', help='Ignored')
|
||||||
opt.add_option ('--disable-maintainer-mode', 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 build (bld):
|
||||||
def image_to_win32ico (task):
|
def image_to_win32ico (task):
|
||||||
'Converts an image to a Win32 ico'
|
'Converts an image to a Win32 ico'
|
||||||
|
@ -498,6 +514,8 @@ def build (bld):
|
||||||
distclean ()
|
distclean ()
|
||||||
|
|
||||||
def distclean ():
|
def distclean ():
|
||||||
|
if os.path.exists ('po/LINGUAS'):
|
||||||
|
os.remove ('po/LINGUAS')
|
||||||
if os.path.exists ('po/midori.pot'):
|
if os.path.exists ('po/midori.pot'):
|
||||||
os.remove ('po/midori.pot')
|
os.remove ('po/midori.pot')
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue