Index: cms/sources.py |
=================================================================== |
--- a/cms/sources.py |
+++ b/cms/sources.py |
@@ -142,34 +142,33 @@ |
def read_static(self, filename): |
return self.read_file(self.static_filename(filename), binary=True)[0] |
# |
# Locale helpers |
# |
- @classmethod |
- def locale_filename(cls, locale, page): |
- return cls.localizable_file_filename(locale, page + '.json') |
+ def locale_filename(self, locale, page): |
+ config = self.read_config() |
+ try: |
+ page = config.get('locale_overrides', page) |
+ except ConfigParser.Error: |
+ pass |
+ return self.localizable_file_filename(locale, page + '.json') |
def list_locales(self): |
result = set() |
for filename in self.list_files('locales'): |
if '/' in filename: |
locale, path = filename.split('/', 1) |
result.add(locale) |
return result |
def has_locale(self, locale, page): |
- config = self.read_config() |
- try: |
- page = config.get('locale_overrides', page) |
- except ConfigParser.Error: |
- pass |
return self.has_file(self.locale_filename(locale, page)) |
def read_locale(self, locale, page): |
default_locale = self.read_config().get('general', 'defaultlocale') |
result = collections.OrderedDict() |
if locale != default_locale: |
result.update(self.read_locale(default_locale, page)) |