[et-mgmt-tools] [PATCH 1/2] Build and install locale files if present.
Daniel P. Berrange
berrange at redhat.com
Wed Jul 4 04:36:59 UTC 2007
On Mon, Jul 02, 2007 at 04:26:37PM -0400, Cole Robinson wrote:
> This patch contains the necessary changes to the build/install process
> to accommodate locale files. The main changes are in the setup.py script
> where several operations were overloaded to
>
> 1) Build any .po files it finds in the po directory to .mo
> 2) Place these files in INSTALLROOT/share/locale as appropriate
> 3) Do appropriate locale path replacement in __init__.py so
> virtinst knows where to find the locale files.
>
> I'm not sure if their is a better place for the gettext includes than
> __init__.py, but it seems to work for the library and the scripts that
> use it (virt-install and virt-clone).
Its a bit of a problem because it will clash with the translation catalog
installed by virt-manager. So the combo of
gettext.install(gettext_app, gettext_dir)
Along with the use of '_' will end up trying to pull translations from
virt-manager's catalog. What you need to do is not call gettext.intsall
or locale.setlocal at all - simple have the bindtextdomain call in the
__init__ file. Then you need to define a convenience wrapper using
dgettext
def _virtinst(msg):
return gettext.dgettext(getext_app, msg)
And finally, in each of the virtinst .py files I think you need:
from virtinst import _virtinst as _
Finally, the virt-install, and virt-clone commands also need to have the
locale.setlocale, and gettext.install commands in them.
This all basically is to make sure that if used from virt-install/virt-clone
the global message catalog is install, but if used from virt-manager it is
not installed. If you see what i mean. Its a little hairy :-)
Regards,
Dan.
--
|=- Red Hat, Engineering, Emerging Technologies, Boston. +1 978 392 2496 -=|
|=- Perl modules: http://search.cpan.org/~danberr/ -=|
|=- Projects: http://freshmeat.net/~danielpb/ -=|
|=- GnuPG: 7D3B9505 F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 -=|
More information about the et-mgmt-tools
mailing list