Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Translating content in filesystem for a Plone product

I'm trying to get certain strings in a .py file translated, using the i18n machinery. Translating .pt files is not a problem, but whenever I try to translate using _('Something') in Python code on the filesystem, it always gives English text (which is the default) instead of the Norwegian text that should be there. So I can see output from python code in English, while other Page Templates bits are correctly translated.

Is there a how-to or something similar for this?

like image 684
user880151 Avatar asked Jan 27 '26 05:01

user880151


2 Answers

if you are seeking for how-tos you should probably read these docs:

  • http://plone.org/documentation/kb/i18n-for-developers
  • http://readthedocs.org/docs/collective-docs/en/latest/i18n/localization.html

Bye, Giacomo

like image 131
Giacomo Spettoli Avatar answered Jan 28 '26 18:01

Giacomo Spettoli


Is the domain name used for _('Something') the same as what you use in the Norwegian .po file that has the translation? They should be the same, so do not use 'plone' in one case and 'my.domain' in the other.

Also, the call to the underscore function does not in itself translate the string; it only creates a string that can be translated. If this string ends up on its own directly in a template, you should add i18n:translate="" to that tag, probably with a matching i18n:domain.

Otherwise you should manually call the translate method, as in http://readthedocs.org/docs/collective-docs/en/latest/i18n/localization.html#manually-translated-message-ids. Read the Plone 4 migration guide for some differences between Plone 3 and 4 that might bite you here.

like image 31
maurits Avatar answered Jan 28 '26 19:01

maurits