[et-mgmt-tools] [PATCH 1/2] Build and install locale files if present.

Cole Robinson crobinso at redhat.com
Mon Jul 9 19:49:12 UTC 2007


Daniel P. Berrange wrote:
> 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.
> 

Updated patch is attached.

> 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 :-)

Yeah it's definitely confusing, but I think I understand it now :)

Thanks,
Cole

-- 
Cole Robinson
crobinso at redhat.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: virtinst-i18n-install-02.patch
Type: text/x-patch
Size: 23656 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/et-mgmt-tools/attachments/20070709/9319ae8d/attachment.bin>


More information about the et-mgmt-tools mailing list