Re: [Zope] Re: i18n/L10n support in zope2
Maurits van Rees wrote: After making change and updating sample page template - (English as primary language for both browsers) html body English - span i18n:domain=English i18n:translate= Reload this catalog /span br German - span i18n:domain=Germany i18n:translate= Reload this catalog /span br Czech - span i18n:domain=Czech i18n:translate= Reload this catalog /span br /body /html Huh? You now state languages in the i18n domain. Don't you mean to make this three times the same domain and then perhaps add the i18n:target en/de/cs? Yes..using i18n:target (not in Zope 2.9.7 at least as no support there :) ) with single domain can be much better approach. But honestly I am just beginner in this i18n/L10n arena, so need to work on i18n/L10n rules/standards. Thank you, Harshad. ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] Re: i18n/L10n support in zope2
Maurits, Thanks for the reply and suggestions. I tried i18n:translate=, it works fine. But if I change domain (e.g i18n:domain=mydomain) it doesn't work. Is domain attribute is related to the domain specified in .po file, coz the example .po file which comes with PlacelessTranslationService has domain as 'PlacelessTranslationService' and if I used same it works fine. Actually I used i18n:target after reading - http://wiki.zope.org/zope3/ZPTInternationalizationExamples. I do understand that these are zope3 examples, but just thought of giving try. While searching further I found - https://bugs.launchpad.net/zope2/+bug/142771 which gives hint that i18n:target not supported at least for Zope 2.9.7-final, python 2.4.4, win32 I will try to check for incoming browser headers, but does zope provides any inbuilt method to do so ? Thank you, Harshad. Maurits van Rees wrote: harshad behere, on 2008-04-09: Dear list members, I am newbie/begineer in area of zope2 + i18n/L10n so please excuse me if this topic has already been discussed on the list, in that case can some one please point me to the past discussions/threads. After reading some basics about i18n+zope2, I have tried following - (zope version - Zope 2.9.7-final, python 2.4.4, win32 and Placeless Translation Service - 1.3.7) Created simple page template - html body span i18n:domain=PlacelessTranslationService i18n:translate=Reload this catalog Reload this catalog /span /body /html I would expect either: i18n:translate= so that the string behind it ends up in the .pot file (and you don't repeat yourself needlessly; also think what would happen when you change one string but forget to change the other). Or: i18n:translate=reload_this_catalog or some other unique message id. But the above code should work. Well, using PlacelessTranslationService as i18n:domain is strange. You should use the name of your own product/package. Modified language preferences for browsers - (Mozilla Firefox 2.0.0.4 and MS-IE 7.0.5730.11) to set German [de] as primary langage. When I viewed above page in firfox got the corresponing german translation (Diesen Katalog neu einlesen) as specified in related .po file. But with MS-IE, no luck, gives same string - Reload this catalog So is it browser specific/dependable ? It should not. Do you have a way to check which browser headers are sent by IE and firefox and if they differ in the language preference? Another thing I tried is adding attribute i18n:target=cs, but it seems to have no effect, firefox gives german translation as per language settings as MS-IE gives same string - Reload this catalog Does it means that attribute target is not supported ? Is there any list/documentation about supported i18n attributes ? I have never seen that attribute. From the top of my head, these i18n attributes are used in zope: translate, domain, name and attributes. Also I was not able to find references/examples for DTML, does DTML supports i18n/L10n ? No. At least, I do not think so, and this grep in a buildout did not return any relevant results: grep i18n $(find . -name '*dtml') ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] Re: i18n/L10n support in zope2
Maurits van Rees wrote: In Firefox you can use the livehttpheaders extension to check those. I don't know if there is something similar to IE. In zope this information should be visible somewhere in the request object. To display the complete request in a page template for inspection you can probably do this: div tal:replace=structure request / or simply this div tal:content=request / Ooops.. I missed out REQUEST While debugging negotiation mechanizm of PTS I found following headers are being consulted - HTTP_ACCEPT_LANGUAGE, _pts_negotiator_cache_language,_pts_catalog_names_PlacelessTranslationService_??? And here are the details -- MS-IE 7.0.5730.11 -- HTTP_ACCEPT_LANGUAGE 'de-DE,en-us;q=0.5' _pts_negotiator_cache_language {('cs', 'el', 'de', 'pt-br', 'en'): None} _pts_catalog_names_PlacelessTranslationService_none [] Mozilla Firefox 2.0.0.4 -- HTTP_ACCEPT_LANGUAGE'de,en;q=0.7,en-us;q=0.3' _pts_negotiator_cache_language{('cs', 'el', 'de', 'pt-br', 'en'): 'de'} _pts_catalog_names_PlacelessTranslationService_de ['PlacelessTranslationService.i18n-pts-de.po'] Here are related entries from .po file - Language-code: de\n Language-name: Deutsch\n I suspect 'de-DE' from MSIE is the issue here. Thank you, Harshad. ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] Re: i18n/L10n support in zope2
Maurits van Rees wrote: harshad behere, on 2008-04-10: Maurits, Thanks for the reply and suggestions. I tried i18n:translate=, it works fine. But if I change domain (e.g i18n:domain=mydomain) it doesn't work. Is domain attribute is related to the domain specified in .po file, coz the example .po file which comes with PlacelessTranslationService has domain as 'PlacelessTranslationService' and if I used same it works fine. Yes, the two should be the same. But if you use this domain and other people use it too because it is the standard example then you can get conflicting translations. Yes completely agreed. I tried changing domain in given example .po file (e.g. to Domain=mydomain\n), but it doesn't work even after doing Reload catalog for corresponding .po file object using PTS ZMI. I found reload catalog works if we modify message ids/text. Any idea how PTS manages this headers (like Domain/Content-Type etc) ? Is it possible to reload/refresh/rebuild this information ? Thank you, Harshad. ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] Re: i18n/L10n support in zope2
I tried changing domain in given example .po file (e.g. to Domain=mydomain\n), but it doesn't work even after doing Reload catalog for corresponding .po file object using PTS ZMI. I found reload catalog works if we modify message ids/text. Any idea how PTS manages this headers (like Domain/Content-Type etc) ? Is it possible to reload/refresh/rebuild this information ? While working further I found following work aroud ( may not be on correct path, but it works) -- Edit the headings part (e.g Domain/Language etc) for .po files and save file. -- Make use of PTS ZMI to delete corresponding ZODB object of .po file. -- Restart Zope. I also found workaound for MSIE behaviour, include heading call X-Is-Fallback-For: ?\n in your .po file. For e.g - X-Is-Fallback-For: de-de\n. After making change and updating sample page template - (English as primary language for both browsers) html body English - span i18n:domain=English i18n:translate= Reload this catalog /span br German - span i18n:domain=Germany i18n:translate= Reload this catalog /span br Czech - span i18n:domain=Czech i18n:translate= Reload this catalog /span br /body /html gives following o/p Mozilla Firefox 2.0.0.4 - -- English - Reload this catalog -- German - Reload this catalog -- Czech - Reload this catalog MS-IE 7.0.5730.11 - -- English - Reload this catalog -- German - Diesen Katalog neu einlesen -- Czech - Znovu nacĂst katalog Interest thing is that MSIE respects selected language hierarchy where as FireFox gives preference to the primary one. Here are the headers - Mozilla Firefox 2.0.0.4 HTTP_ACCEPT_LANGUAGE'en-us,en;q=0.8,de;q=0.5,cs;q=0.3' _pts_catalog_names_Germany_en[] _pts_catalog_names_Czech_en[] _pts_catalog_names_English_en [] _pts_negotiator_cache_language{('de', 'de-de', 'en'): 'en', ('en',): 'en', ('cs', 'cs-cz', 'en'): 'en'} MS-IE 7.0.5730.11 HTTP_ACCEPT_LANGUAGE 'en-us,de-DE;q=0.7,cs-CZ;q=0.3' _pts_catalog_names_Czech_cs-cz ['PlacelessTranslationService.i18n-pts-cs.po'] _pts_catalog_names_Germany_de-de ['PlacelessTranslationService.i18n-pts-de.po'] _pts_catalog_names_English_none [] _pts_negotiator_cache_language {('de', 'de-de', 'en'): 'de-de', ('en',): None, ('cs', 'cs-cz', 'en'): 'cs-cz'} Thank you, Harshad. ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )