summaryrefslogtreecommitdiff
path: root/lib/inx/utils.py
diff options
context:
space:
mode:
authorKate Murphy <hello@kate.io>2019-04-17 21:16:38 -0400
committerGitHub <noreply@github.com>2019-04-17 21:16:38 -0400
commit8a2b6287ee630bf9c1d0eff3f219565773b47651 (patch)
treefd5454040832b82d3b5362d0118c1c7a1cff37cb /lib/inx/utils.py
parentd388dc60854131a7b749be278ff24045869870de (diff)
parent3251b94332c291689cc76751a7be8629a6c7e64a (diff)
Merge pull request #437 from inkstitch/locale-releases
Separate locales into different releases
Diffstat (limited to 'lib/inx/utils.py')
-rw-r--r--lib/inx/utils.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/inx/utils.py b/lib/inx/utils.py
index a22b1892..1dc96829 100644
--- a/lib/inx/utils.py
+++ b/lib/inx/utils.py
@@ -1,3 +1,4 @@
+import errno
import os
import gettext
from os.path import dirname
@@ -28,8 +29,16 @@ def build_environment():
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:
+ inx_locale_dir = os.path.join(inx_path, current_locale)
+
+ try:
+ os.makedirs(inx_locale_dir)
+ except OSError as e:
+ if e.errno != errno.EEXIST:
+ raise
+
+ inx_file_name = "inkstitch_%s.inx" % name
+ with open(os.path.join(inx_locale_dir, inx_file_name), 'w') as inx_file:
print >> inx_file, contents.encode("utf-8")