[Zope3-checkins] CVS: Zope3/src/zope/i18n - negotiator.py:1.6.48.3

Sidnei da Silva sidnei at x3ng.com.br
Mon Mar 1 08:08:53 EST 2004


Update of /cvs-repository/Zope3/src/zope/i18n
In directory cvs.zope.org:/tmp/cvs-serv13308

Modified Files:
      Tag: runyaga-sip-branch
	negotiator.py 
Log Message:
Fallback to base language in case the specific variation is not available.


=== Zope3/src/zope/i18n/negotiator.py 1.6.48.2 => 1.6.48.3 ===
--- Zope3/src/zope/i18n/negotiator.py:1.6.48.2	Mon Mar  1 07:15:59 2004
+++ Zope3/src/zope/i18n/negotiator.py	Mon Mar  1 08:08:22 2004
@@ -47,6 +47,15 @@
         for lang in userlangs:
             if lang in langs:
                 return langs.get(lang)
+            # If the user asked for a specific
+            # variation, but we don't have it available
+            # we may serve the most generic one, according
+            # to the spec (eg: user asks for ('en-us', 'de'),
+            # but we don't have 'en-us', then 'en' is
+            # preffered to 'de').
+            parts = lang.split('-')
+            if len(parts) > 1 and parts[0] in langs:
+                return langs.get(parts[0])
         return None
 
 




More information about the Zope3-Checkins mailing list