[Zope3-checkins] CVS: Zope3/src/zope/i18n - locales.py:1.9
Barry Warsaw
barry@wooz.org
Tue, 25 Mar 2003 09:30:07 -0500
Update of /cvs-repository/Zope3/src/zope/i18n
In directory cvs.zope.org:/tmp/cvs-serv19348/src/zope/i18n
Modified Files:
locales.py
Log Message:
LocaleProvider:
getLocale(): We want to be liberal in what we accept but the
lookup algorithms expect lowercased language, and uppercased
country and variant. Normalize here.
getDateFormat(): The class claimed to implement ILocale but was
missing this method. Add it but make it raise NotImplementedError
for now.
=== Zope3/src/zope/i18n/locales.py 1.8 => 1.9 ===
--- Zope3/src/zope/i18n/locales.py:1.8 Thu Mar 13 13:49:13 2003
+++ Zope3/src/zope/i18n/locales.py Tue Mar 25 09:30:06 2003
@@ -11,7 +11,7 @@
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
-"""Locale and LocaleProdiver Implmentation.
+"""Locale and LocaleProvider Implementation.
$Id$
"""
@@ -108,9 +108,17 @@
locale = ICUXMLLocaleFactory(path)()
self._locales[(language, country, variant)] = locale
-
def getLocale(self, language=None, country=None, variant=None):
"See ZopeProducts.LocaleProvider.interfaces.ILocaleProvider"
+ # We want to be liberal in what we accept, but the standard is lower
+ # case language codes, upper case country codes, and upper case
+ # variants, so coerce case here.
+ if language:
+ language = language.lower()
+ if country:
+ country = country.upper()
+ if variant:
+ variant = variant.upper()
if not self._locales.has_key((language, country, variant)):
self.loadLocale(language, country, variant)
return self._locales[(language, country, variant)]
@@ -736,6 +744,11 @@
pass # Locale has no number format information
return NumberFormat(pattern, symbols)
+
+ def getDateFormat(self, name):
+ """Get the DateFormat object called 'name'. The following names are
+ recognized: full, long, medium, short."""
+ raise NotImplementedError
class ICUXMLLocaleFactory: