Nmap Development mailing list archives
Re: Does Zenmap localization "just work" on Windows?
From: Dirk Loss <lists () dirk-loss de>
Date: Mon, 02 Feb 2009 19:26:39 +0100
David Fifield wrote:
On Sat, Jan 31, 2009 at 05:58:46PM +0100, Dirk Loss wrote:Nmap 4.85BETA2 on my German Windows XP SP2 virtual machine still shows all texts in English per default. (Setting LANG=de_DE changes the output to German, as described on the web page.)Thanks, that's exactly the information I was looking for. I'll see if there's a way to make Python gettext aware of the native Windows locale setting.
Maybe instead of gettext.install() in I18N.py, you could directly use gettext.translation(), which supports a 'languages' argument. This could be initalized with 'locale.getdefaultlocale()[0]', which returns 'de_DE' on my Windows machine.
The attached patch is untested, because I can't compile Zenmap on my Windows machine, but it should give you the idea.
Regards Dirk
Index: I18N.py =================================================================== --- I18N.py (revision 11932) +++ I18N.py (working copy) @@ -35,8 +35,18 @@ try: import gettext - gettext.install(APP_NAME, Path.locale_dir, unicode = True) + try: + lang = locale.getdefaultlocale()[0] or None + except Exception: + lang = None + t = gettext.translation(APP_NAME, Path.locale_dir, languages=lang, fallback=True) + t.install(unicode=True, names=None) + except ImportError: # define _() so program will not fail import __builtin__ __builtin__.__dict__["_"] = str + +# The above code puts _ with the builtin functions. Also put in in this module's +# namespace to allow other modules to import it from here. +_ = _
_______________________________________________ Sent through the nmap-dev mailing list http://cgi.insecure.org/mailman/listinfo/nmap-dev Archived at http://SecLists.Org
Current thread:
- Does Zenmap localization "just work" on Windows? David Fifield (Jan 13)
- Re: Does Zenmap localization "just work" on Windows? David Fifield (Jan 25)
- Re: Does Zenmap localization "just work" on Windows? Dirk Loss (Jan 31)
- Re: Does Zenmap localization "just work" on Windows? Dirk Loss (Jan 31)
- Re: Does Zenmap localization "just work" on Windows? David Fifield (Feb 01)
- Re: Does Zenmap localization "just work" on Windows? Dirk Loss (Feb 02)
- Re: Does Zenmap localization "just work" on Windows? David Fifield (Feb 03)
- Re: Does Zenmap localization "just work" on Windows? Dirk Loss (Jan 31)
- Re: Does Zenmap localization "just work" on Windows? David Fifield (Jan 25)