Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: cms/sources.py

Issue 29659605: Issue 6231 - Add tests for translation string substitution (Closed)
Patch Set: Add tests for different types of pages; also for includes and templates Created Jan. 12, 2018, 7:53 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tests/expected_output/de/translate » ('j') | tests/test_translations.py » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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))
« no previous file with comments | « no previous file | tests/expected_output/de/translate » ('j') | tests/test_translations.py » ('J')

Powered by Google App Engine
This is Rietveld