Respect NLSPATH in Midori and use it for ./waf build --run

This commit is contained in:
Christian Dywan 2009-01-22 01:59:23 +01:00
parent 3350872069
commit a63942cd79
4 changed files with 41 additions and 13 deletions

View file

@ -12,7 +12,12 @@ Run './waf configure'
Run './waf build'
You can now run Midori from _build_/default/midori
You can now run Midori from the build folder like so
'./waf build --run'
This is a convenience that will load extensions as well as
localizations from the build folder.
You can install it with './waf install'
@ -20,7 +25,7 @@ For further options run './waf --help'
+++ Debugging Midori +++
Run './waf configure -d debug' from the Midori folder.
Run './waf configure -d full' from the Midori folder.
Run './waf build'

View file

@ -21,20 +21,19 @@ To check your language 'aa' for errors, do this:
msgfmt -c --check-accelerators=_ aa.po
To test your changes, make sure you install Midori:
To test your changes, run Midori like so:
./waf install
./waf build --run
And of course you can uninstall it again after testing:
./waf uninstall
This is a convenience command that will setup localization in
the build folder so you don't need to install translations.
To run Midori in a particular language, run it like this:
LANG=fr_FR.utf8 midori
LANG=fr_FR.utf8 ./waf build --run
As a general rule, your localization should be based off of the
current state of the git repository.
current git repository or the latest midori.pot in git.
Some strings have comments, starting with 'i18n', which are meant
to describe the role of a string to translators.

View file

@ -1950,6 +1950,10 @@ main (int argc,
#endif
#if ENABLE_NLS
setlocale (LC_ALL, "");
if (g_getenv ("NLSPATH"))
bindtextdomain (GETTEXT_PACKAGE, g_getenv ("NLSPATH"));
else
bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
textdomain (GETTEXT_PACKAGE);

26
wscript
View file

@ -80,7 +80,6 @@ def configure (conf):
if conf.env['INTLTOOL'] and conf.env['POCOM']:
nls = 'yes'
conf.define ('ENABLE_NLS', 1)
conf.define ('MIDORI_LOCALEDIR', 'LOCALEDIR', 0)
else:
option_checkfatal ('nls', 'localization')
nls = 'N/A'
@ -383,10 +382,31 @@ def shutdown ():
Utils.pprint ('RED', "Make sure intltool is installed.")
os.chdir ('..')
elif Options.options.run:
def mkdir (path):
if not os.access (path, os.F_OK):
os.mkdir (path)
folder = os.path.dirname (Build.bld.env['waf_config_files'][0])
try:
ext = 'MIDORI_EXTENSION_PATH=' + folder + os.sep + 'extensions'
nls = 'NLSPATH=' + folder + os.sep + 'po'
lang = os.environ['LANG']
try:
for lang in os.listdir (folder + os.sep + 'po'):
if lang[3:] == 'mo':
lang = lang[:-3]
else:
continue
mkdir (folder + os.sep + 'po' + os.sep + lang)
mkdir (folder + os.sep + 'po' + os.sep + lang + \
os.sep + 'LC_MESSAGES')
os.symlink (folder + os.sep + 'po' + os.sep + lang + '.mo',
folder + os.sep + 'po' + os.sep + lang + os.sep + \
'LC_MESSAGES' + os.sep + APPNAME + '.mo')
except:
pass
command = folder + os.sep + APPNAME + os.sep + APPNAME
Utils.exec_command ('MIDORI_EXTENSION_PATH=' + folder + \
os.sep + 'extensions' + ' ' + command)
print ext + ' ' + nls + ' ' + command
Utils.exec_command (ext + ' ' + nls + ' ' + command)
except:
Utils.pprint ('RED', "Failed to run application.")