diff options
| author | Lex Neva <lexelby@users.noreply.github.com> | 2018-08-24 20:52:28 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-08-24 20:52:28 -0400 |
| commit | 1de8487849a3f8f55d126e2687d690226e657fde (patch) | |
| tree | 1bd891b97f8447cb3f513d073d20cea5d4534461 /lib/inx | |
| parent | b3bb975401fe4971170239eea9b928ee13161398 (diff) | |
| parent | 91eb98cc33602f19dddc186c034aed968e048404 (diff) | |
Merge pull request #288 from inkstitch/lexelby/style
fix coding style and enforce style checks in build
Diffstat (limited to 'lib/inx')
| -rw-r--r-- | lib/inx/generate.py | 5 | ||||
| -rw-r--r-- | lib/inx/utils.py | 9 |
2 files changed, 8 insertions, 6 deletions
diff --git a/lib/inx/generate.py b/lib/inx/generate.py index f9ed799b..941596de 100644 --- a/lib/inx/generate.py +++ b/lib/inx/generate.py @@ -1,9 +1,8 @@ -import os - from .inputs import generate_input_inx_files from .outputs import generate_output_inx_files from .extensions import generate_extension_inx_files -from .utils import iterate_inx_locales, inx_path +from .utils import iterate_inx_locales + def generate_inx_files(): for locale in iterate_inx_locales(): diff --git a/lib/inx/utils.py b/lib/inx/utils.py index 7c471276..54b37c58 100644 --- a/lib/inx/utils.py +++ b/lib/inx/utils.py @@ -3,7 +3,7 @@ import gettext from os.path import dirname from jinja2 import Environment, FileSystemLoader -from ..i18n import translation as default_translation, locale_dir, _, N_ +from ..i18n import translation as default_translation, locale_dir, N_ _top_path = dirname(dirname(dirname(os.path.realpath(__file__)))) @@ -13,10 +13,11 @@ template_path = os.path.join(_top_path, "templates") current_translation = default_translation current_locale = "en_US" + def build_environment(): env = Environment( - loader = FileSystemLoader(template_path), - autoescape = True, + loader=FileSystemLoader(template_path), + autoescape=True, extensions=['jinja2.ext.i18n'] ) @@ -25,11 +26,13 @@ def build_environment(): return env + def write_inx_file(name, contents): inx_file_name = "inkstitch_%s_%s.inx" % (name, current_locale) with open(os.path.join(inx_path, inx_file_name), 'w') as inx_file: print >> inx_file, contents.encode("utf-8") + def iterate_inx_locales(): global current_translation, current_locale |
