[Zope3-checkins] CVS: Zope3/src/zope/i18n - locales.py:1.7
Jeremy Hylton
jeremy@zope.com
Mon, 27 Jan 2003 16:49:04 -0500
Update of /cvs-repository/Zope3/src/zope/i18n
In directory cvs.zope.org:/tmp/cvs-serv29750
Modified Files:
locales.py
Log Message:
Add update methods that take dicts.
=== Zope3/src/zope/i18n/locales.py 1.6 => 1.7 ===
--- Zope3/src/zope/i18n/locales.py:1.6 Fri Jan 10 13:55:32 2003
+++ Zope3/src/zope/i18n/locales.py Mon Jan 27 16:49:01 2003
@@ -501,6 +501,14 @@
two-letter id."""
self._languages[id] = name
+ def updateLanguageNames(self, dict):
+ """Add a dictionary of languages.
+
+ The dict should map a two-letter id to the language in the locale's
+ native language.
+ """
+ self._languages.update(dict)
+
def getLanguageName(self, id):
"""Get the localized language name for the given id."""
return self._languages[id]
@@ -514,6 +522,15 @@
two-letter id."""
self._countries[id] = name
+ def updateCountryNames(self, dict):
+ """Add a dictionary of countries.
+
+ The dict should map the country's two-letter id to the country's
+ name in its native language.
+ """
+ self._countries.update(dict)
+
+
def getCountryName(self, id):
"""Get the localized country name for the given id."""
return self._countries[id]
@@ -1027,12 +1044,8 @@
# Set Versioning
for version in self._extractVersions():
locale.setVersion(version)
- # Set Languages
- for lang in self._extractLanguages().items():
- locale.setLanguageName(*lang)
- # Set Countries
- for country in self._extractCountries().items():
- locale.setCountryName(*country)
+ locale.updateLanguageNames(self._extractLanguages())
+ locale.updateCountryNames(self._extractCountries())
# Set TimeZones
for tz in self._extractTimeZones():
locale.setTimeZone(*tz)