Re: i18n messages aus Plone Product extrahieren

Thomas Maßmann <[email protected]>
Newsgroups gmane.comp.web.zope.german
Message-ID <[email protected]>
Hallo Jan,

das ganze geht mit i18ndude (Installation über easy_install) + gettext  
ganz gut.

Angenommen Dein Produkt heißt my.product (erstellt mit paster) und  
Deine Domain auch. Dann musst Du im Ordner src/my/product/ einen  
Ordner locales/de/LC_MESSAGES z.B. für deutsch anlegen (geht auch über  
paster) und dann die folgenden Befehle ausführen:

$ i18ndude rebuild-pot --pot locales/my.product.pot --create  
my.product .
$ touch locales/de/LC_MESSAGES/my.product.po //die Datei muss  
existieren, sonst meckert i18ndude
$ i18ndude sync --pot locales/my.product.pot locales/de/LC_MESSAGES/ 
my.product.po
$ msgfmt locales/de/LC_MESSAGES/my.product.po -o locales/de/ 
LC_MESSAGES/my.product.mo --no-hash

Letzteren Befehl brauchst Du nicht wenn Du Poedit benutzt, das  
compiliert die .mo automatisch.


In die configure.zcml muss dann noch folgender Eintrag hinein:

<configure
     xmlns="http://namespaces.zope.org/zope"
     xmlns:five="http://namespaces.zope.org/five"
     xmlns:genericsetup="http://namespaces.zope.org/genericsetup"
     xmlns:i18n="http://namespaces.zope.org/i18n"
     i18n_domain="my.product">
...

     <i18n:registerTranslations directory="locales" />
...

Ich habe aber die Erfahrung gemacht, dass i18ndude Einträge wie  
label_msgid ignoriert. Wenn Du hingegen in Deinem Schema folgendes  
hast (wie es paster auch anlegt über addcontent)

     atapi.StringField(
         'my_field',
         storage=atapi.AnnotationStorage(),
         widget=atapi.StringWidget(
             label=_(u"My Field Name"),
             description=_(u"My Field Description"),
         ),
     ),

dann geht das ganz gut. Fehlende msgids kannst Du ja immer noch per  
Hand hinzufügen. Du musst aber aufpassen, dass Du das am besten in ein  
extra .pot-File schreibst und ein merge ausführst, da i18ndude sonst  
beim nächsten rebuild-pot Deine Einträge wieder entfernt.

Viele Grüße
Thomas


Am 14.04.2009 um 20:35 schrieb Jan Ulrich Hasecke:

> Irgendwie finde ich keinen Ansatz, um aus einem Plone3 Produkt die  
> i18n message ids zu extrahieren und in ein pot oder locales file zu  
> schreiben.
>
> juh
>
>
> _______________________________________________
> zope mailing list
> [email protected]
> https://mail.dzug.org/mailman/listinfo/zope

EDV-Beratung Thomas Maßmann
E-Mail: [email protected]
WWW: it-spir.it





_______________________________________________
zope mailing list
[email protected]
https://mail.dzug.org/mailman/listinfo/zope
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.