[pygtk] Translation: Different locales directories
Walter Leibbrandt
walter at translate.org.za
Mon May 31 17:33:11 WST 2010
Op 30/05/2010 18:04, het Cornelius Kölbel geskryf:
> Hello List,
>
> i got an application with translation.
>
> I am doing this...
>
> gettext.bindtextdomain(APP_NAME, LOCALE_DIR)
> gettext.textdomain(APP_NAME)
>
> But my problem is, that I do different packaging types like source, deb
> and rpm. In these different cases, the location of the mo file is not
> the same for the different packages.
>
> What is the recommended way to handle this?
> Can I provide more than one locale dirs?
> Should I change the code, for each packaging type?
> Should I set an environment variable that contains the correct locales dir?
The get_abs_data_filename() function [1] as used by Virtaal [2] does the
job on at least Windows and Linux, running from source or from intsallation.
Another solution I've seen is to calculate this location on installation
and programmatically change a specific source file, from where this
value is imported/accessed by the application.
[1]:
https://translate.svn.sourceforge.net/svnroot/translate/src/trunk/translate/misc/file_discovery.py
[2]:
https://translate.svn.sourceforge.net/svnroot/translate/src/trunk/virtaal/virtaal/views/baseview.py
HTH,
--
Walter Leibbrandt Software Developer
Recent blogs:
* Ubuntu PPA for Translate Toolkit and Virtaal
http://www.translate.org.za/blogs/walter/en/content/ubuntu-ppa-translate-toolkit-and-virtaal
More information about the pygtk
mailing list