Log message for revision 66792:
  Made sure LocalizerLanguages class normalized language codes to xx-yy.
  

Changed:
  U   Products.Five/trunk/CHANGES.txt
  U   Products.Five/trunk/i18n.py

-=-
Modified: Products.Five/trunk/CHANGES.txt
===================================================================
--- Products.Five/trunk/CHANGES.txt     2006-04-10 15:25:56 UTC (rev 66791)
+++ Products.Five/trunk/CHANGES.txt     2006-04-10 15:28:07 UTC (rev 66792)
@@ -2,6 +2,12 @@
 Five Changes
 ============
 
+Trunk (unreleased)
+=======================
+
+* Made sure LocalizerLanguages class normalized language codes to xx-yy, 
instead of
+  xx_YY or xx-YY.
+
 Five 1.4b (2006-03-31)
 ======================
 

Modified: Products.Five/trunk/i18n.py
===================================================================
--- Products.Five/trunk/i18n.py 2006-04-10 15:25:56 UTC (rev 66791)
+++ Products.Five/trunk/i18n.py 2006-04-10 15:28:07 UTC (rev 66792)
@@ -19,6 +19,7 @@
 from zope.interface import implements
 from zope.i18n import interpolate
 from zope.i18n.interfaces import ITranslationDomain, IUserPreferredLanguages
+from zope.i18n.negotiator import normalize_lang
 from zope.app import zapi
 from zope.publisher.browser import BrowserLanguages
 
@@ -71,7 +72,9 @@
         accept_language = self.context.AcceptLanguage
         langs = []
         for lang, node in accept_language.children.items():
-            langs.append((node.get_quality(), lang))
+            # Localizer may use xx_YY and xx-YY as language codes,
+            # while Zope expect xx-yy only, so we normalize the code here.
+            langs.append((node.get_quality(), normalize_lang(lang)))
             langs.extend([(n.get_quality(), l) for l, n
                           in node.children.items()])
         langs.sort()

_______________________________________________
Zope-Checkins maillist  -  Zope-Checkins@zope.org
http://mail.zope.org/mailman/listinfo/zope-checkins

Reply via email to