Low-level locale data access.
- :note: The `Locale` class, which uses this module under the hood, provides
- a more convenient interface for accessing the locale data.
+ :note: The `Locale` class, which uses this module under the hood, provides a
+ more convenient interface for accessing the locale data.
:copyright: (c) 2013 by the Babel Team.
:license: BSD, see LICENSE for more details.
_cache = {}
_cache_lock = threading.RLock()
-_dirname = os.path.dirname(__file__)
+_dirname = os.path.join(os.path.dirname(__file__), 'localedata')
def exists(name):
def __getitem__(self, key):
orig = val = self._data[key]
- if isinstance(val, Alias): # resolve an alias
+ if isinstance(val, Alias): # resolve an alias
val = val.resolve(self.base)
- if isinstance(val, tuple): # Merge a partial dict with an alias
+ if isinstance(val, tuple): # Merge a partial dict with an alias
alias, others = val
val = alias.resolve(self.base).copy()
merge(val, others)
- if type(val) is dict: # Return a nested alias-resolving dict
+ if type(val) is dict: # Return a nested alias-resolving dict
val = LocaleDataDict(val, base=self.base)
if val is not orig:
self._data[key] = val