This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
Home Products Support Community News


Re: [Xen-devel] Correct management of .po files for translation

To: Ewan Mellor <ewan@xxxxxxxxxxxxx>
Subject: Re: [Xen-devel] Correct management of .po files for translation
From: "Daniel P. Berrange" <berrange@xxxxxxxxxx>
Date: Thu, 5 Apr 2007 23:11:30 +0100
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Thu, 05 Apr 2007 15:10:29 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <20070404163116.GU7262@xxxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <20070404160223.GA25108@xxxxxxxxxx> <20070404163116.GU7262@xxxxxxxxxxxxxxxxxxxxxx>
Reply-to: "Daniel P. Berrange" <berrange@xxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.4.1i
On Wed, Apr 04, 2007 at 05:31:16PM +0100, Ewan Mellor wrote:
> On Wed, Apr 04, 2007 at 05:02:23PM +0100, Daniel P. Berrange wrote:
> > Basically the code is abusing the gettext translation service to do both the
> > constant -> string conversion & the translation in one go. The normal way to
> > do the constant -> string conversion is to have a statically declared hash
> > table in the application itself. This contains the master english strings
> > annotated with  N_(...string..).  The xgettext program will then generate
> > the .pot files automatically in the correct format.
> > 
> > I'm attaching an example to show how this ought to work in the Xen case.
> > The makefiles could be hooked up to automatically run
> > 
> >   xgettext --keyword=N_ -o xen-xm.pot tools/python/xen/xm/XenAPI.py
> Sounds good to me, Daniel, thanks.  Could you write a patch to hook up the
> Makefiles as well?  I reckon we'll be able to sneak this one in for 3.0.5 if
> you did.

I'm attaching a patch which hooks up the tools/python/Makefile to update
the master xen-xm.pot file with new translatable text on every biuld, and
to merge these into any translations. The install rule was tweaked to deal
with the different build process.

There is no actual language translation in the patch - when adding new 
translations simply 

   cd xen/xm/messages
   cp xen-xm.pot fr_FR.po
   vi fr_FR.po

Also edit tools/python/Makefile to add the language code 'fr_FR' to the
LINGUAS makefile variable.

NB, since I don't have a current xen-unstable.hg kernel build operational
on my dev hardware currently I've not yet been able to test the correct
operational of the XenAPI.py changes in this patch. Hopefully I'll be able
to get a working kernel on this machine soon

 a/tools/python/xen/xm/messages/en/xen-xm.po |   69 ----------------------------
 b/tools/python/remove-potcdate.sed          |   19 +++++++
 b/tools/python/xen/xm/messages/xen-xm.pot   |   63 +++++++++++++++++++++++++
 config/StdGNU.mk                            |    1 
 tools/python/Makefile                       |   68 ++++++++++++++++++++++-----
 tools/python/xen/xm/XenAPI.py               |   18 ++++++-
 7 files changed, 218 insertions(+), 83 deletions(-)

   Signed-off-by: Daniel P. Berrange <berrange@xxxxxxxxxx>

|=- 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  -=| 

Attachment: xen-gettext.patch
Description: Text document

Xen-devel mailing list
<Prev in Thread] Current Thread [Next in Thread>