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() |
Vasily Kuznetsov
2018/01/12 19:56:49
Unfortunately I had to also make this substantive
Jon Sonesen
2018/01/19 04:45:37
Hm, I have played with it a fair amount and it see
Vasily Kuznetsov
2018/01/19 15:34:29
Checked on help.eyeo.com, web.acceptableads.org, w
|
+ 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)) |