|
Hi !
I would like a hint about usage of i18n machinery in an utf environnement. I have a plone 2.x website, running well (thank you). I have a page template with let's say :
--- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" xmlns:tal="http://xml.zope.org/namespaces/tal"
xmlns:metal="http://xml.zope.org/namespaces/metal" xmlns:i18n="http://xml.zope.org/namespaces/i18n"
tal:attributes="lang language; xml:lang language" metal:use-macro="here/main_template/macros/master"
i18n:domain="mydomain"> <p i18n:translate="">Here is a test</p> </html>
--- Using .po files, it works like a charm, Now if I use utf-8 chars inside <p>, like : <p i18n:translate="">J'ai la quéquette qui colle</p>
(of course same html tag, and note french accents in sentence) This time i18n translation does "nothing"...appears untranslated... Any hint, please ?
Cequi.
------------------------------------------------------------------------------ This SF.net email is sponsored by: SourcForge Community SourceForge wants to tell your story. http://p.sf.net/sfu/sf-spreadtheword _______________________________________________ Plone-i18n mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/plone-i18n |
|
Administrator
|
On Mon, 02 Feb 2009 12:52:01 -0800, Céqui Chlorraine
<[hidden email]> wrote: > Using .po files, it works like a charm, > > Now if I use utf-8 chars inside <p>, like : > > <p i18n:translate="">J'ai la quéquette qui colle</p> > > (of course same html tag, and note french accents in sentence) > > This time i18n translation does "nothing"...appears untranslated... > > Any hint, please ? Never use non-ascii in templates — if you do, you have to use HTML entities, e.g. ü. Let the template string be English, and the translation reside in a .po file. (I also think this was less strict before we switched to the ZPT implementation from Zope 3, but it has never been a good idea to use utf-8 directly in templates :) -- Alexander Limi · http://limi.net ------------------------------------------------------------------------------ Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM) software. With Adobe AIR, Ajax developers can use existing skills and code to build responsive, highly engaging applications that combine the power of local resources and data with the reach of the web. Download the Adobe AIR SDK and Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com _______________________________________________ Plone-i18n mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/plone-i18n |
|
Thanx Alexander. Unfortunately, these webpages contains technical sentences that can can not be written in English. It's translated later, in a xxx-en.po. Doing english back to .pt would be too much work (for nothing :()
However, I did solve the issue with a bugfix in PTS who forgot to take care of unicode in msgid : @@ -532,7 +532,7 @@ catalogs = self.getCatalogsForTranslation(context, domain, target_language)
for catalog in catalogs: try: - text = getMessage(catalog, msgid, default) + text = getMessage(catalog, msgid.decode(catalog._charset), default)
except KeyError: # it's not in this catalog, try the next one continue Thanx for your answer,
Cequi. 2009/2/9 Alexander Limi <[hidden email]>
------------------------------------------------------------------------------ Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM) software. With Adobe AIR, Ajax developers can use existing skills and code to build responsive, highly engaging applications that combine the power of local resources and data with the reach of the web. Download the Adobe AIR SDK and Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com _______________________________________________ Plone-i18n mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/plone-i18n |
|
Céqui Chlorraine wrote:
> Thanx Alexander. Unfortunately, these webpages contains technical > sentences that can can not be written in English. It's translated later, > in a xxx-en.po. Doing english back to .pt would be too much work (for > nothing :() > > However, I did solve the issue with a bugfix in PTS who forgot to take > care of unicode in msgid : > > @@ -532,7 +532,7 @@ > catalogs = self.getCatalogsForTranslation(context, domain, > target_language) > for catalog in catalogs: > try: > - text = getMessage(catalog, msgid, default) > + text = getMessage(catalog, > msgid.decode(catalog._charset), default) > except KeyError: > # it's not in this catalog, try the next one > continue That's actually not a bug. The gettext manual states: Note that the msgid argument to gettext is not subject to character set conversion. Also, when gettext does not find a translation for msgid, it returns msgid unchanged – independently of the current output character set. It is therefore recommended that all msgids be US-ASCII strings. Hanno ------------------------------------------------------------------------------ Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM) software. With Adobe AIR, Ajax developers can use existing skills and code to build responsive, highly engaging applications that combine the power of local resources and data with the reach of the web. Download the Adobe AIR SDK and Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com _______________________________________________ Plone-i18n mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/plone-i18n |
| Powered by Nabble | Edit this page |
