WARNING - OLD ARCHIVES

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/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

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

To: "Daniel P. Berrange" <berrange@xxxxxxxxxx>
Subject: Re: [Xen-devel] Correct management of .po files for translation
From: Ewan Mellor <ewan@xxxxxxxxxxxxx>
Date: Wed, 4 Apr 2007 17:31:16 +0100
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Wed, 04 Apr 2007 09:30:08 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <20070404160223.GA25108@xxxxxxxxxx>
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>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.5.9i
On Wed, Apr 04, 2007 at 05:02:23PM +0100, Daniel P. Berrange wrote:

> In updating Fedora rawhide to work against xen-unstable.hg (3.0.5) I noticed
> that there is now gettext support for translating the error messages returned
> from XenAPI in xm. Unfortauntely the way the .po files have been created is
> completely wrong & useless for translators to work kwith.
> 
> First there is no master .pot file - merely an english 'translation'. Since
> the convention is for the untranslated strings to be in english to start with,
> providing an english .po  file is redundant unless you specialize it to a
> variant like  en_GB.po
> 
> The core problem though is that the catalog file ..
> 
> tools/python/xen/xm/messages/en/xen-xm.po
> 
> ..does not contain untranslated strings at all - it is instead full of 
> symbolic
> constants.
> 
>   msgid "INTERNAL_ERROR"
>   msgstr "Internal error: %(1)s."
> 
>   msgid "MAP_DUPLICATE_KEY"
>   msgstr "This map already contains %(1)s -> %(2)s."
> 
>   msgid "MESSAGE_METHOD_UNKNOWN"
>   msgstr "The method %(1)s is unsupported."
> 
>   msgid "MESSAGE_PARAMETER_COUNT_MISMATCH"
>   msgstr "The method %(1)s takes %(2)s argument(s) (%(3)s given)."
> 
> There are two critical reasons why msgid should always contain the master
> english untranslated string:
> 
>   - Translators need to be able to compare the original english alongside
>     the translated text to ensure accurate translations. Referring to external
>     files to find the english is not practical
> 
>   - The msgmerge tool used to periodically update the catelogs looks at
>     the msgid entries to identify added / removed / editted strings. If
>     the msgid is a symbolic constant it'll never be able to identify strings
>     which have changed & thus mark them as needing re-translation
> 
> 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.

Ewan.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>