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' 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' You can install it with './waf install'
@ -20,7 +25,7 @@ For further options run './waf --help'
+++ Debugging Midori +++ +++ Debugging Midori +++
Run './waf configure -d debug' from the Midori folder. Run './waf configure -d full' from the Midori folder.
Run './waf build' Run './waf build'

View file

@ -21,20 +21,19 @@ To check your language 'aa' for errors, do this:
msgfmt -c --check-accelerators=_ aa.po 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: This is a convenience command that will setup localization in
the build folder so you don't need to install translations.
./waf uninstall
To run Midori in a particular language, run it like this: 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 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 Some strings have comments, starting with 'i18n', which are meant
to describe the role of a string to translators. to describe the role of a string to translators.

View file

@ -1950,7 +1950,11 @@ main (int argc,
#endif #endif
#if ENABLE_NLS #if ENABLE_NLS
bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); 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"); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
textdomain (GETTEXT_PACKAGE); textdomain (GETTEXT_PACKAGE);
#endif #endif

26
wscript
View file

@ -80,7 +80,6 @@ def configure (conf):
if conf.env['INTLTOOL'] and conf.env['POCOM']: if conf.env['INTLTOOL'] and conf.env['POCOM']:
nls = 'yes' nls = 'yes'
conf.define ('ENABLE_NLS', 1) conf.define ('ENABLE_NLS', 1)
conf.define ('MIDORI_LOCALEDIR', 'LOCALEDIR', 0)
else: else:
option_checkfatal ('nls', 'localization') option_checkfatal ('nls', 'localization')
nls = 'N/A' nls = 'N/A'
@ -383,10 +382,31 @@ def shutdown ():
Utils.pprint ('RED', "Make sure intltool is installed.") Utils.pprint ('RED', "Make sure intltool is installed.")
os.chdir ('..') os.chdir ('..')
elif Options.options.run: 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]) folder = os.path.dirname (Build.bld.env['waf_config_files'][0])
try: 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 command = folder + os.sep + APPNAME + os.sep + APPNAME
Utils.exec_command ('MIDORI_EXTENSION_PATH=' + folder + \ print ext + ' ' + nls + ' ' + command
os.sep + 'extensions' + ' ' + command) Utils.exec_command (ext + ' ' + nls + ' ' + command)
except: except:
Utils.pprint ('RED', "Failed to run application.") Utils.pprint ('RED', "Failed to run application.")