Quoting "Peter Irbizon" <peterirbizon@...>:
> Hello Dieter, thank you for your solution with
> import sys
> if not hasattr(sys, "frozen"): .... it works.
Good! I'll add it to elib.intl soon.
> But what's more I found something interesting.
> elib.intl.install('gtk20', local_path) is not working - is not
> traslating gtk.
> elib.intl.install('gtk20', local_path) #THIS IS NOT WORKING
No need to do that. GTK+ and other libraries already take care of
initializing their gettext support themselves.
> elib.intl.install('translation', local_path) #this works ok for
> other strings in my app
This is the function you'd use to install the _() function in the global
namespace. It is intended to be used on an application level only and never
inside a library.
> _ = elib.intl.install_module('translation', local_path)#this works
> ok for other strings in my app
This is the function you'd use when writing a library. You'd store _()
somewhere in your library's namespace and use it from the Python modules
your library contains.
It is wise to call *exactly one* of those functions:
- *only a single time* for your library or application;
- *before* you do anything else. When you call one of the install()
functions when gtk, glib, gobject, atk, cairo, pango, etc are
already imported it is too late and nothing can be done to force
those C libraries to initialize their gettext support.
> when I print local_path it is C:\app\locale\shares but when I change
> elib.intl.install('gtk20', local_path) to
> elib.intl.install('gtk20', 'C:/app/locale/shares') #please mind
> backslahes now it works for gtk as well. How is this possible that
> for gtk path in local_path vartiable is not working but for my other
> texts in my app it works?
I think you're seeing the results of calling one of the install() functions
too late. See above...
Also, I always use some form of:
bindir = os.path.dirname(__file__)
localedir = os.path.join(bindir, '..', 'share', 'locale')
localedir = os.path.abspath(localedir)
to make sure my executable is relocatable at runtime (ie it is not bound
to be installed in some hardcoded path). You may need to adapt the bindir
calculation when frozen, I seem to remember there was a need to do
something special but my memory seems to fail me here...
> many thanks,
This message was sent using IMP, the Internet Messaging Program.