[Cubicweb] A few questions regarding CubicWeb customization

Sylvain Thénault sylvain.thenault at logilab.fr
Tue Sep 20 08:31:57 CEST 2011


On 19 septembre 22:16, Florent Cayré wrote:
> Le 19/09/2011 20:51, Fidel Viegas a écrit :
> >Another question is regarding the inclusion of other cubes. Can I
> >overwrite any i18n files within my cube? Or do I have to create a
> >translation for each cube?
> >
> Not sure I understood your question, but I guess you want to
> override another cube's translation. You can, here's how : in a file
> you can call i18n_overload.py (in the root directory of your cube
> for example), list the words you want to customize so that gettext
> detect them. For example, if you want to override the translation of
> the word "Entity" (already present in CW i18n files of course), add
> _('Entity') on one line of your i18n_overload.py ("_" will be
> automatically added to the globals before importing, however you can
> add "_ = unicode" at the top of the file if you want to have a
> clean, importable python module), then, in a shell, issue a
> cubicweb-ctl i18ncube YOUR_CUBE command, and you get the new word in
> the i18n/*.po files of your cube. Translate it as you wish and issue
> a cubicweb-ctl i18ninstance YOUR_INSTANCE to see the new translation
> in your web instance.

another option to the .py hack is a <cube>/i18n/static-messages.pot
gettext catalog file where you list msgid you want to override.

My 0.2 cents

Sylvain Thénault                               LOGILAB, Paris (France)
Formations Python, Debian, Méth. Agiles: http://www.logilab.fr/formations
Développement logiciel sur mesure:       http://www.logilab.fr/services
CubicWeb, the semantic web framework:    http://www.cubicweb.org

More information about the Cubicweb mailing list