Skip to content

Commit

Permalink
i18n lint II
Browse files Browse the repository at this point in the history
  • Loading branch information
odudex committed Sep 17, 2024
1 parent 1e7021c commit 1a4da99
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions i18n/i18n.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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 = [
Expand Down Expand Up @@ -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
Expand All @@ -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",
Expand Down

0 comments on commit 1a4da99

Please sign in to comment.