wichert / lingua

Translation toolkit for Python
Other
46 stars 32 forks source link

Feature Request: HTML inside .po Default value #12

Closed lvonlanthen closed 12 years ago

lvonlanthen commented 12 years ago

Dear developing team,

I gracefully use lingua within my Pyramid project. While I was able to get everything to work, I stumbled upon the following issue that I was unable to resolve: I wanted to extract HTML tags from my Chameleon template into the Default value of my .po file.

For further details, please see my question asked over at stackoverflow (http://stackoverflow.com/questions/9559756/pot-file-with-tags-instead-of-dynamic-element) or similarly on the Google Pylons group (http://groups.google.com/group/pylons-discuss/browse_thread/thread/eb5ca27b1494cfd2/51c849bf27410215).

I don't think this is possible with Lingua so far. Do you think this feature could be implemented in future development? I'd very much appreciate this.

Thank you very much! Lukas

wichert commented 12 years ago

I'm afraid this is an anti-goal. A translation should only contain the text - it should never contain markup. Otherwise it would also be impossible for the template language to see if characters in a translation should be considered to be markup, or need to be escaped.

It is common to need to translate items with dynamic components or markup inside them: for those you use the i18n:name attribute. For example you can do this:

<p i18n:translate="">This is <strong i18n:name="very" i18n:translate="">very</strong> important.

That would give you two strings to translate: This is ${very} string and very.