monra commited on
Commit
060d729
1 Parent(s): afb20df

Update server/babel.py

Browse files
Files changed (1) hide show
  1. server/babel.py +12 -19
server/babel.py CHANGED
@@ -1,5 +1,4 @@
1
  import os
2
- import stat
3
  import subprocess
4
  from flask import request, session, jsonify
5
  from flask_babel import Babel
@@ -35,21 +34,15 @@ def get_languages():
35
  return jsonify(BABEL_LANGUAGES)
36
 
37
 
38
- def compile_translations():
39
- """Compile the translation files."""
40
-
41
- for root, dirs, files in os.walk('translations'):
42
- os.chmod(root, stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO)
43
- for d in dirs:
44
- os.chmod(os.path.join(root, d), stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO)
45
-
46
- result = subprocess.run(
47
- ['pybabel', 'compile', '-d', 'translations'],
48
- stdout=subprocess.PIPE,
49
- )
50
-
51
- if result.returncode != 0:
52
- raise Exception(
53
- f'Compiling translations failed:\n{result.stdout.decode()}')
54
-
55
- print('Translations compiled successfully')
 
1
  import os
 
2
  import subprocess
3
  from flask import request, session, jsonify
4
  from flask_babel import Babel
 
34
  return jsonify(BABEL_LANGUAGES)
35
 
36
 
37
+ def compile_translations():
38
+ """Compile the translation files."""
39
+ result = subprocess.run(
40
+ ['pybabel', 'compile', '-d', 'translations'],
41
+ stdout=subprocess.PIPE,
42
+ )
43
+
44
+ if result.returncode != 0:
45
+ raise Exception(
46
+ f'Compiling translations failed:\n{result.stdout.decode()}')
47
+
48
+ print('Translations compiled successfully')