From 1a4da99f4fe86499abb822cd1098648692e16915 Mon Sep 17 00:00:00 2001 From: odudex Date: Tue, 17 Sep 2024 16:04:18 -0300 Subject: [PATCH] i18n lint II --- i18n/i18n.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/i18n/i18n.py b/i18n/i18n.py index ba1287a6..a91e4fb6 100644 --- a/i18n/i18n.py +++ b/i18n/i18n.py @@ -19,12 +19,14 @@ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. + import binascii import sys import json from os import listdir, walk, mkdir from os.path import isfile, isdir, exists, join, basename import re +from translate import Translator SRC_DIR = "../src" TRANSLATION_FILES_DIR = "translations" @@ -115,7 +117,6 @@ def print_missing(): force_target = sys.argv[2] else: force_target = None - from translate import Translator slugs = find_translation_slugs() translation_filenames = [ @@ -190,7 +191,10 @@ def remove_unnecessary(): def bake_translations(): - """Bakes individual translation tables into separate files inside the krux namespace within a 'translations' subfolder.""" + """ + Bakes individual translation tables into separate files inside the krux namespace + within a 'translations' subfolder. + """ translations_dir = join(SRC_DIR, "krux", "translations") # Create the translations subfolder if it doesn't exist @@ -217,7 +221,8 @@ def bake_translations(): translations_array.append(translations[slug]) language_code = basename(translation_filename).split(".")[0][:2] - # Write the individual translation table to a separate Python file in the 'translations' subfolder + # Write the individual translation array to a separate Python file + # in the 'translations' subfolder with open( join(translations_dir, f"{language_code}.py"), "w",