Allow for templates/settings to be read and compiled.

This allows for the handlebars templates in the template/settings
subdirectory to be found and compiled.
This commit is contained in:
Brock Whittaker
2016-10-04 16:36:26 -07:00
committed by Tim Abbott
parent 82764d0215
commit 3efe3601b8
2 changed files with 5 additions and 4 deletions

View File

@@ -146,9 +146,9 @@ class Command(makemessages.Command):
translation_strings = {} # type: Dict[str, str]
dirname = self.get_template_dir()
for filename in os.listdir(dirname):
if filename.endswith('handlebars'):
with open(os.path.join(dirname, filename), 'r') as reader:
for dirpath, dirnames, filenames in os.walk(dirname):
for filename in [f for f in filenames if f.endswith(".handlebars")]:
with open(os.path.join(dirpath, filename), 'r') as reader:
data = reader.read()
data = data.replace('\n', '\\n')
translation_strings.update(self.extract_strings(data))