Skip to content

Commit b06bf8f

Browse files
committed
Snake-cased function/arg names ↞ [auto-sync from https://github.com/adamlui/python-utils/tree/main/translate-messages]
1 parent 28ee7b9 commit b06bf8f

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

translate-messages/__main__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
cli.config.output_langs.append(discovered_lang)
3030
cli.config.output_langs.sort()
3131

32-
langs_translated, langs_skipped, langs_added, langs_not_translated = language.writeTranslations(cli)
32+
langs_translated, langs_skipped, langs_added, langs_not_translated = language.write_translations(cli)
3333

3434
log.final_summary({
3535
'translated': langs_translated,

translate-messages/cli.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "translate-messages",
3-
"version": "2026.2.12.1",
3+
"version": "2026.2.12.2",
44
"author": { "name": "Adam Lui", "email": "adam@kudoai.com", "url": "https://github.com/adamlui" },
55
"description": "Translate en/messages.json to other locales. Type --help to view options",
66
"urls": {

translate-messages/lib/data/json.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ def read(path):
44
if not os.path.exists(path) : return {}
55
with open(path, 'r', encoding='utf-8') as file : return json.load(file)
66

7-
def write(srcData, targetPath):
8-
os.makedirs(os.path.dirname(targetPath), exist_ok=True)
9-
with open(targetPath, 'w', encoding='utf-8') as file:
10-
json.dump(srcData, file, indent=2, ensure_ascii=False)
7+
def write(src_data, target_path):
8+
os.makedirs(os.path.dirname(target_path), exist_ok=True)
9+
with open(target_path, 'w', encoding='utf-8') as file:
10+
json.dump(src_data, file, indent=2, ensure_ascii=False)

translate-messages/lib/language.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from lib import data, log
33
from translate import Translator
44

5-
def createTranslations(cli, target_msgs, lang_code):
5+
def create_translations(cli, target_msgs, lang_code):
66
src_keys = list(cli.config.en_msgs.keys()) ; translated_msgs = {}
77
fail_flags = ['INVALID TARGET LANGUAGE', 'TOO MANY REQUESTS', 'MYMEMORY']
88

@@ -29,7 +29,7 @@ def createTranslations(cli, target_msgs, lang_code):
2929

3030
return translated_msgs
3131

32-
def writeTranslations(cli):
32+
def write_translations(cli):
3333
langs_added, langs_skipped, langs_translated, langs_not_translated = [], [], [], []
3434
for lang_code in cli.config.output_langs:
3535
lang_added, lang_skipped, lang_translated = False, False, False
@@ -51,7 +51,7 @@ def writeTranslations(cli):
5151

5252
log.trunc(f"{ 'Adding' if not msgs else 'Updating' } {lang_folder}/{cli.config.msgs_filename}...", end='')
5353
sys.stdout.flush()
54-
translated_msgs = createTranslations(cli, msgs, lang_code)
54+
translated_msgs = create_translations(cli, msgs, lang_code)
5555
data.json.write(translated_msgs, msgs_path)
5656

5757
if translated_msgs == msgs : langs_skipped.append(lang_code) ; lang_skipped = True

0 commit comments

Comments
 (0)