From a63942cd790f3d1a46342a88b3223068b608b959 Mon Sep 17 00:00:00 2001 From: Christian Dywan Date: Thu, 22 Jan 2009 01:59:23 +0100 Subject: [PATCH] Respect NLSPATH in Midori and use it for ./waf build --run --- INSTALL | 9 +++++++-- TRANSLATE | 13 ++++++------- midori/main.c | 6 +++++- wscript | 26 +++++++++++++++++++++++--- 4 files changed, 41 insertions(+), 13 deletions(-) diff --git a/INSTALL b/INSTALL index 89dd7340..a771fae9 100644 --- a/INSTALL +++ b/INSTALL @@ -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' diff --git a/TRANSLATE b/TRANSLATE index e620cb65..9b2bbffb 100644 --- a/TRANSLATE +++ b/TRANSLATE @@ -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. diff --git a/midori/main.c b/midori/main.c index 7ad1ef0f..1afd87e1 100644 --- a/midori/main.c +++ b/midori/main.c @@ -1950,7 +1950,11 @@ main (int argc, #endif #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"); textdomain (GETTEXT_PACKAGE); #endif diff --git a/wscript b/wscript index 3ad01795..73be9cc6 100644 --- a/wscript +++ b/wscript @@ -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.") -- 2.39.5