Skip to content

Commit 1c2327f

Browse files
committed
Moved default_target_locales into env ↞ [auto-sync from https://github.com/adamlui/python-utils/tree/main/translate-messages]
1 parent c0de701 commit 1c2327f

7 files changed

Lines changed: 77 additions & 84 deletions

File tree

chatgpt/amazongpt/utils/translate-en-messages.py

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'''
22
Name: translate-en-messages.py
3-
Version: 2026.2.10.23
3+
Version: 2026.2.10.24
44
Author: Adam Lui
55
Description: Translate en/messages.json to other locales
66
Homepage: https://github.com/adamlui/python-utils
@@ -17,18 +17,17 @@
1717

1818
cli = sns(
1919
name='translate-messages',
20-
urls=sns(jsdelivr='https://cdn.jsdelivr.net/gh/adamlui/python-utils')
20+
urls=sns(jsdelivr='https://cdn.jsdelivr.net/gh/adamlui/python-utils'),
21+
default_target_locales=[
22+
'af', 'am', 'ar', 'az', 'be', 'bem', 'bg', 'bn', 'bo', 'bs', 'ca', 'ceb', 'cs', 'cy', 'da', 'de', 'dv', 'dz', 'el',
23+
'en', 'en-GB', 'eo', 'es', 'et', 'eu', 'fa', 'fi', 'fo', 'fr', 'gd', 'gl', 'gu', 'haw', 'he', 'hi', 'hr', 'ht',
24+
'hu', 'hy', 'id', 'is', 'it', 'ja', 'ka', 'kab', 'kk', 'km', 'kn', 'ko', 'ku', 'ky', 'la', 'lb', 'lo', 'lt', 'lv',
25+
'mg', 'mi', 'mk', 'ml', 'mn', 'ms', 'mt', 'my', 'ne', 'nl', 'no', 'ny', 'pa', 'pap', 'pl', 'ps', 'pt', 'ro', 'ru',
26+
'rw', 'sg', 'si', 'sk', 'sl', 'sm', 'sn', 'so', 'sr', 'sv', 'sw', 'ta', 'te', 'tg', 'th', 'ti', 'tk', 'tn', 'tpi',
27+
'tr', 'uk', 'ur', 'uz', 'vi', 'xh', 'yi', 'zh', 'zh-CN', 'zh-HK', 'zh-SG', 'zh-TW', 'zu'
28+
]
2129
)
2230

23-
default_target_locales = [
24-
'af', 'am', 'ar', 'az', 'be', 'bem', 'bg', 'bn', 'bo', 'bs', 'ca', 'ceb', 'cs', 'cy', 'da', 'de', 'dv', 'dz', 'el',
25-
'en', 'en-GB', 'eo', 'es', 'et', 'eu', 'fa', 'fi', 'fo', 'fr', 'gd', 'gl', 'gu', 'haw', 'he', 'hi', 'hr', 'ht',
26-
'hu', 'hy', 'id', 'is', 'it', 'ja', 'ka', 'kab', 'kk', 'km', 'kn', 'ko', 'ku', 'ky', 'la', 'lb', 'lo', 'lt', 'lv',
27-
'mg', 'mi', 'mk', 'ml', 'mn', 'ms', 'mt', 'my', 'ne', 'nl', 'no', 'ny', 'pa', 'pap', 'pl', 'ps', 'pt', 'ro', 'ru',
28-
'rw', 'sg', 'si', 'sk', 'sl', 'sm', 'sn', 'so', 'sr', 'sv', 'sw', 'ta', 'te', 'tg', 'th', 'ti', 'tk', 'tn', 'tpi',
29-
'tr', 'uk', 'ur', 'uz', 'vi', 'xh', 'yi', 'zh', 'zh-CN', 'zh-HK', 'zh-SG', 'zh-TW', 'zu'
30-
]
31-
3231
# Init/load config file
3332
cli.script_name = os.path.splitext(os.path.basename(__file__))[0]
3433
cli.config_filename = f'{cli.script_name}.config.json'
@@ -68,7 +67,7 @@
6867
def parse_csv_langs(str) : return [lang.strip() for lang in str.split(',') if lang.strip()]
6968
include_arg = args.include_langs or cli.config_data.get('include_langs', '')
7069
exclude_arg = args.exclude_langs or cli.config_data.get('exclude_langs', '')
71-
target_locales = parse_csv_langs(include_arg) or default_target_locales
70+
target_locales = parse_csv_langs(include_arg) or cli.default_target_locales
7271
exclude_langs = set(parse_csv_langs(exclude_arg))
7372
target_locales = [lang for lang in target_locales if lang not in exclude_langs]
7473

chatgpt/autoclear-chatgpt-history/utils/translate-en-messages.py

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'''
22
Name: translate-en-messages.py
3-
Version: 2026.2.10.23
3+
Version: 2026.2.10.24
44
Author: Adam Lui
55
Description: Translate en/messages.json to other locales
66
Homepage: https://github.com/adamlui/python-utils
@@ -17,18 +17,17 @@
1717

1818
cli = sns(
1919
name='translate-messages',
20-
urls=sns(jsdelivr='https://cdn.jsdelivr.net/gh/adamlui/python-utils')
20+
urls=sns(jsdelivr='https://cdn.jsdelivr.net/gh/adamlui/python-utils'),
21+
default_target_locales=[
22+
'af', 'am', 'ar', 'az', 'be', 'bem', 'bg', 'bn', 'bo', 'bs', 'ca', 'ceb', 'cs', 'cy', 'da', 'de', 'dv', 'dz', 'el',
23+
'en', 'en-GB', 'eo', 'es', 'et', 'eu', 'fa', 'fi', 'fo', 'fr', 'gd', 'gl', 'gu', 'haw', 'he', 'hi', 'hr', 'ht',
24+
'hu', 'hy', 'id', 'is', 'it', 'ja', 'ka', 'kab', 'kk', 'km', 'kn', 'ko', 'ku', 'ky', 'la', 'lb', 'lo', 'lt', 'lv',
25+
'mg', 'mi', 'mk', 'ml', 'mn', 'ms', 'mt', 'my', 'ne', 'nl', 'no', 'ny', 'pa', 'pap', 'pl', 'ps', 'pt', 'ro', 'ru',
26+
'rw', 'sg', 'si', 'sk', 'sl', 'sm', 'sn', 'so', 'sr', 'sv', 'sw', 'ta', 'te', 'tg', 'th', 'ti', 'tk', 'tn', 'tpi',
27+
'tr', 'uk', 'ur', 'uz', 'vi', 'xh', 'yi', 'zh', 'zh-CN', 'zh-HK', 'zh-SG', 'zh-TW', 'zu'
28+
]
2129
)
2230

23-
default_target_locales = [
24-
'af', 'am', 'ar', 'az', 'be', 'bem', 'bg', 'bn', 'bo', 'bs', 'ca', 'ceb', 'cs', 'cy', 'da', 'de', 'dv', 'dz', 'el',
25-
'en', 'en-GB', 'eo', 'es', 'et', 'eu', 'fa', 'fi', 'fo', 'fr', 'gd', 'gl', 'gu', 'haw', 'he', 'hi', 'hr', 'ht',
26-
'hu', 'hy', 'id', 'is', 'it', 'ja', 'ka', 'kab', 'kk', 'km', 'kn', 'ko', 'ku', 'ky', 'la', 'lb', 'lo', 'lt', 'lv',
27-
'mg', 'mi', 'mk', 'ml', 'mn', 'ms', 'mt', 'my', 'ne', 'nl', 'no', 'ny', 'pa', 'pap', 'pl', 'ps', 'pt', 'ro', 'ru',
28-
'rw', 'sg', 'si', 'sk', 'sl', 'sm', 'sn', 'so', 'sr', 'sv', 'sw', 'ta', 'te', 'tg', 'th', 'ti', 'tk', 'tn', 'tpi',
29-
'tr', 'uk', 'ur', 'uz', 'vi', 'xh', 'yi', 'zh', 'zh-CN', 'zh-HK', 'zh-SG', 'zh-TW', 'zu'
30-
]
31-
3231
# Init/load config file
3332
cli.script_name = os.path.splitext(os.path.basename(__file__))[0]
3433
cli.config_filename = f'{cli.script_name}.config.json'
@@ -68,7 +67,7 @@
6867
def parse_csv_langs(str) : return [lang.strip() for lang in str.split(',') if lang.strip()]
6968
include_arg = args.include_langs or cli.config_data.get('include_langs', '')
7069
exclude_arg = args.exclude_langs or cli.config_data.get('exclude_langs', '')
71-
target_locales = parse_csv_langs(include_arg) or default_target_locales
70+
target_locales = parse_csv_langs(include_arg) or cli.default_target_locales
7271
exclude_langs = set(parse_csv_langs(exclude_arg))
7372
target_locales = [lang for lang in target_locales if lang not in exclude_langs]
7473

chatgpt/bravegpt/utils/translate-en-messages.py

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'''
22
Name: translate-en-messages.py
3-
Version: 2026.2.10.23
3+
Version: 2026.2.10.24
44
Author: Adam Lui
55
Description: Translate en/messages.json to other locales
66
Homepage: https://github.com/adamlui/python-utils
@@ -17,18 +17,17 @@
1717

1818
cli = sns(
1919
name='translate-messages',
20-
urls=sns(jsdelivr='https://cdn.jsdelivr.net/gh/adamlui/python-utils')
20+
urls=sns(jsdelivr='https://cdn.jsdelivr.net/gh/adamlui/python-utils'),
21+
default_target_locales=[
22+
'af', 'am', 'ar', 'az', 'be', 'bem', 'bg', 'bn', 'bo', 'bs', 'ca', 'ceb', 'cs', 'cy', 'da', 'de', 'dv', 'dz', 'el',
23+
'en', 'en-GB', 'eo', 'es', 'et', 'eu', 'fa', 'fi', 'fo', 'fr', 'gd', 'gl', 'gu', 'haw', 'he', 'hi', 'hr', 'ht',
24+
'hu', 'hy', 'id', 'is', 'it', 'ja', 'ka', 'kab', 'kk', 'km', 'kn', 'ko', 'ku', 'ky', 'la', 'lb', 'lo', 'lt', 'lv',
25+
'mg', 'mi', 'mk', 'ml', 'mn', 'ms', 'mt', 'my', 'ne', 'nl', 'no', 'ny', 'pa', 'pap', 'pl', 'ps', 'pt', 'ro', 'ru',
26+
'rw', 'sg', 'si', 'sk', 'sl', 'sm', 'sn', 'so', 'sr', 'sv', 'sw', 'ta', 'te', 'tg', 'th', 'ti', 'tk', 'tn', 'tpi',
27+
'tr', 'uk', 'ur', 'uz', 'vi', 'xh', 'yi', 'zh', 'zh-CN', 'zh-HK', 'zh-SG', 'zh-TW', 'zu'
28+
]
2129
)
2230

23-
default_target_locales = [
24-
'af', 'am', 'ar', 'az', 'be', 'bem', 'bg', 'bn', 'bo', 'bs', 'ca', 'ceb', 'cs', 'cy', 'da', 'de', 'dv', 'dz', 'el',
25-
'en', 'en-GB', 'eo', 'es', 'et', 'eu', 'fa', 'fi', 'fo', 'fr', 'gd', 'gl', 'gu', 'haw', 'he', 'hi', 'hr', 'ht',
26-
'hu', 'hy', 'id', 'is', 'it', 'ja', 'ka', 'kab', 'kk', 'km', 'kn', 'ko', 'ku', 'ky', 'la', 'lb', 'lo', 'lt', 'lv',
27-
'mg', 'mi', 'mk', 'ml', 'mn', 'ms', 'mt', 'my', 'ne', 'nl', 'no', 'ny', 'pa', 'pap', 'pl', 'ps', 'pt', 'ro', 'ru',
28-
'rw', 'sg', 'si', 'sk', 'sl', 'sm', 'sn', 'so', 'sr', 'sv', 'sw', 'ta', 'te', 'tg', 'th', 'ti', 'tk', 'tn', 'tpi',
29-
'tr', 'uk', 'ur', 'uz', 'vi', 'xh', 'yi', 'zh', 'zh-CN', 'zh-HK', 'zh-SG', 'zh-TW', 'zu'
30-
]
31-
3231
# Init/load config file
3332
cli.script_name = os.path.splitext(os.path.basename(__file__))[0]
3433
cli.config_filename = f'{cli.script_name}.config.json'
@@ -68,7 +67,7 @@
6867
def parse_csv_langs(str) : return [lang.strip() for lang in str.split(',') if lang.strip()]
6968
include_arg = args.include_langs or cli.config_data.get('include_langs', '')
7069
exclude_arg = args.exclude_langs or cli.config_data.get('exclude_langs', '')
71-
target_locales = parse_csv_langs(include_arg) or default_target_locales
70+
target_locales = parse_csv_langs(include_arg) or cli.default_target_locales
7271
exclude_langs = set(parse_csv_langs(exclude_arg))
7372
target_locales = [lang for lang in target_locales if lang not in exclude_langs]
7473

chatgpt/chatgpt-auto-refresh/utils/translate-en-messages.py

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'''
22
Name: translate-en-messages.py
3-
Version: 2026.2.10.23
3+
Version: 2026.2.10.24
44
Author: Adam Lui
55
Description: Translate en/messages.json to other locales
66
Homepage: https://github.com/adamlui/python-utils
@@ -17,18 +17,17 @@
1717

1818
cli = sns(
1919
name='translate-messages',
20-
urls=sns(jsdelivr='https://cdn.jsdelivr.net/gh/adamlui/python-utils')
20+
urls=sns(jsdelivr='https://cdn.jsdelivr.net/gh/adamlui/python-utils'),
21+
default_target_locales=[
22+
'af', 'am', 'ar', 'az', 'be', 'bem', 'bg', 'bn', 'bo', 'bs', 'ca', 'ceb', 'cs', 'cy', 'da', 'de', 'dv', 'dz', 'el',
23+
'en', 'en-GB', 'eo', 'es', 'et', 'eu', 'fa', 'fi', 'fo', 'fr', 'gd', 'gl', 'gu', 'haw', 'he', 'hi', 'hr', 'ht',
24+
'hu', 'hy', 'id', 'is', 'it', 'ja', 'ka', 'kab', 'kk', 'km', 'kn', 'ko', 'ku', 'ky', 'la', 'lb', 'lo', 'lt', 'lv',
25+
'mg', 'mi', 'mk', 'ml', 'mn', 'ms', 'mt', 'my', 'ne', 'nl', 'no', 'ny', 'pa', 'pap', 'pl', 'ps', 'pt', 'ro', 'ru',
26+
'rw', 'sg', 'si', 'sk', 'sl', 'sm', 'sn', 'so', 'sr', 'sv', 'sw', 'ta', 'te', 'tg', 'th', 'ti', 'tk', 'tn', 'tpi',
27+
'tr', 'uk', 'ur', 'uz', 'vi', 'xh', 'yi', 'zh', 'zh-CN', 'zh-HK', 'zh-SG', 'zh-TW', 'zu'
28+
]
2129
)
2230

23-
default_target_locales = [
24-
'af', 'am', 'ar', 'az', 'be', 'bem', 'bg', 'bn', 'bo', 'bs', 'ca', 'ceb', 'cs', 'cy', 'da', 'de', 'dv', 'dz', 'el',
25-
'en', 'en-GB', 'eo', 'es', 'et', 'eu', 'fa', 'fi', 'fo', 'fr', 'gd', 'gl', 'gu', 'haw', 'he', 'hi', 'hr', 'ht',
26-
'hu', 'hy', 'id', 'is', 'it', 'ja', 'ka', 'kab', 'kk', 'km', 'kn', 'ko', 'ku', 'ky', 'la', 'lb', 'lo', 'lt', 'lv',
27-
'mg', 'mi', 'mk', 'ml', 'mn', 'ms', 'mt', 'my', 'ne', 'nl', 'no', 'ny', 'pa', 'pap', 'pl', 'ps', 'pt', 'ro', 'ru',
28-
'rw', 'sg', 'si', 'sk', 'sl', 'sm', 'sn', 'so', 'sr', 'sv', 'sw', 'ta', 'te', 'tg', 'th', 'ti', 'tk', 'tn', 'tpi',
29-
'tr', 'uk', 'ur', 'uz', 'vi', 'xh', 'yi', 'zh', 'zh-CN', 'zh-HK', 'zh-SG', 'zh-TW', 'zu'
30-
]
31-
3231
# Init/load config file
3332
cli.script_name = os.path.splitext(os.path.basename(__file__))[0]
3433
cli.config_filename = f'{cli.script_name}.config.json'
@@ -68,7 +67,7 @@
6867
def parse_csv_langs(str) : return [lang.strip() for lang in str.split(',') if lang.strip()]
6968
include_arg = args.include_langs or cli.config_data.get('include_langs', '')
7069
exclude_arg = args.exclude_langs or cli.config_data.get('exclude_langs', '')
71-
target_locales = parse_csv_langs(include_arg) or default_target_locales
70+
target_locales = parse_csv_langs(include_arg) or cli.default_target_locales
7271
exclude_langs = set(parse_csv_langs(exclude_arg))
7372
target_locales = [lang for lang in target_locales if lang not in exclude_langs]
7473

chatgpt/chatgpt-auto-talk/utils/translate-en-messages.py

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'''
22
Name: translate-en-messages.py
3-
Version: 2026.2.10.23
3+
Version: 2026.2.10.24
44
Author: Adam Lui
55
Description: Translate en/messages.json to other locales
66
Homepage: https://github.com/adamlui/python-utils
@@ -17,18 +17,17 @@
1717

1818
cli = sns(
1919
name='translate-messages',
20-
urls=sns(jsdelivr='https://cdn.jsdelivr.net/gh/adamlui/python-utils')
20+
urls=sns(jsdelivr='https://cdn.jsdelivr.net/gh/adamlui/python-utils'),
21+
default_target_locales=[
22+
'af', 'am', 'ar', 'az', 'be', 'bem', 'bg', 'bn', 'bo', 'bs', 'ca', 'ceb', 'cs', 'cy', 'da', 'de', 'dv', 'dz', 'el',
23+
'en', 'en-GB', 'eo', 'es', 'et', 'eu', 'fa', 'fi', 'fo', 'fr', 'gd', 'gl', 'gu', 'haw', 'he', 'hi', 'hr', 'ht',
24+
'hu', 'hy', 'id', 'is', 'it', 'ja', 'ka', 'kab', 'kk', 'km', 'kn', 'ko', 'ku', 'ky', 'la', 'lb', 'lo', 'lt', 'lv',
25+
'mg', 'mi', 'mk', 'ml', 'mn', 'ms', 'mt', 'my', 'ne', 'nl', 'no', 'ny', 'pa', 'pap', 'pl', 'ps', 'pt', 'ro', 'ru',
26+
'rw', 'sg', 'si', 'sk', 'sl', 'sm', 'sn', 'so', 'sr', 'sv', 'sw', 'ta', 'te', 'tg', 'th', 'ti', 'tk', 'tn', 'tpi',
27+
'tr', 'uk', 'ur', 'uz', 'vi', 'xh', 'yi', 'zh', 'zh-CN', 'zh-HK', 'zh-SG', 'zh-TW', 'zu'
28+
]
2129
)
2230

23-
default_target_locales = [
24-
'af', 'am', 'ar', 'az', 'be', 'bem', 'bg', 'bn', 'bo', 'bs', 'ca', 'ceb', 'cs', 'cy', 'da', 'de', 'dv', 'dz', 'el',
25-
'en', 'en-GB', 'eo', 'es', 'et', 'eu', 'fa', 'fi', 'fo', 'fr', 'gd', 'gl', 'gu', 'haw', 'he', 'hi', 'hr', 'ht',
26-
'hu', 'hy', 'id', 'is', 'it', 'ja', 'ka', 'kab', 'kk', 'km', 'kn', 'ko', 'ku', 'ky', 'la', 'lb', 'lo', 'lt', 'lv',
27-
'mg', 'mi', 'mk', 'ml', 'mn', 'ms', 'mt', 'my', 'ne', 'nl', 'no', 'ny', 'pa', 'pap', 'pl', 'ps', 'pt', 'ro', 'ru',
28-
'rw', 'sg', 'si', 'sk', 'sl', 'sm', 'sn', 'so', 'sr', 'sv', 'sw', 'ta', 'te', 'tg', 'th', 'ti', 'tk', 'tn', 'tpi',
29-
'tr', 'uk', 'ur', 'uz', 'vi', 'xh', 'yi', 'zh', 'zh-CN', 'zh-HK', 'zh-SG', 'zh-TW', 'zu'
30-
]
31-
3231
# Init/load config file
3332
cli.script_name = os.path.splitext(os.path.basename(__file__))[0]
3433
cli.config_filename = f'{cli.script_name}.config.json'
@@ -68,7 +67,7 @@
6867
def parse_csv_langs(str) : return [lang.strip() for lang in str.split(',') if lang.strip()]
6968
include_arg = args.include_langs or cli.config_data.get('include_langs', '')
7069
exclude_arg = args.exclude_langs or cli.config_data.get('exclude_langs', '')
71-
target_locales = parse_csv_langs(include_arg) or default_target_locales
70+
target_locales = parse_csv_langs(include_arg) or cli.default_target_locales
7271
exclude_langs = set(parse_csv_langs(exclude_arg))
7372
target_locales = [lang for lang in target_locales if lang not in exclude_langs]
7473

chatgpt/duckduckgpt/utils/translate-en-messages.py

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'''
22
Name: translate-en-messages.py
3-
Version: 2026.2.10.23
3+
Version: 2026.2.10.24
44
Author: Adam Lui
55
Description: Translate en/messages.json to other locales
66
Homepage: https://github.com/adamlui/python-utils
@@ -17,18 +17,17 @@
1717

1818
cli = sns(
1919
name='translate-messages',
20-
urls=sns(jsdelivr='https://cdn.jsdelivr.net/gh/adamlui/python-utils')
20+
urls=sns(jsdelivr='https://cdn.jsdelivr.net/gh/adamlui/python-utils'),
21+
default_target_locales=[
22+
'af', 'am', 'ar', 'az', 'be', 'bem', 'bg', 'bn', 'bo', 'bs', 'ca', 'ceb', 'cs', 'cy', 'da', 'de', 'dv', 'dz', 'el',
23+
'en', 'en-GB', 'eo', 'es', 'et', 'eu', 'fa', 'fi', 'fo', 'fr', 'gd', 'gl', 'gu', 'haw', 'he', 'hi', 'hr', 'ht',
24+
'hu', 'hy', 'id', 'is', 'it', 'ja', 'ka', 'kab', 'kk', 'km', 'kn', 'ko', 'ku', 'ky', 'la', 'lb', 'lo', 'lt', 'lv',
25+
'mg', 'mi', 'mk', 'ml', 'mn', 'ms', 'mt', 'my', 'ne', 'nl', 'no', 'ny', 'pa', 'pap', 'pl', 'ps', 'pt', 'ro', 'ru',
26+
'rw', 'sg', 'si', 'sk', 'sl', 'sm', 'sn', 'so', 'sr', 'sv', 'sw', 'ta', 'te', 'tg', 'th', 'ti', 'tk', 'tn', 'tpi',
27+
'tr', 'uk', 'ur', 'uz', 'vi', 'xh', 'yi', 'zh', 'zh-CN', 'zh-HK', 'zh-SG', 'zh-TW', 'zu'
28+
]
2129
)
2230

23-
default_target_locales = [
24-
'af', 'am', 'ar', 'az', 'be', 'bem', 'bg', 'bn', 'bo', 'bs', 'ca', 'ceb', 'cs', 'cy', 'da', 'de', 'dv', 'dz', 'el',
25-
'en', 'en-GB', 'eo', 'es', 'et', 'eu', 'fa', 'fi', 'fo', 'fr', 'gd', 'gl', 'gu', 'haw', 'he', 'hi', 'hr', 'ht',
26-
'hu', 'hy', 'id', 'is', 'it', 'ja', 'ka', 'kab', 'kk', 'km', 'kn', 'ko', 'ku', 'ky', 'la', 'lb', 'lo', 'lt', 'lv',
27-
'mg', 'mi', 'mk', 'ml', 'mn', 'ms', 'mt', 'my', 'ne', 'nl', 'no', 'ny', 'pa', 'pap', 'pl', 'ps', 'pt', 'ro', 'ru',
28-
'rw', 'sg', 'si', 'sk', 'sl', 'sm', 'sn', 'so', 'sr', 'sv', 'sw', 'ta', 'te', 'tg', 'th', 'ti', 'tk', 'tn', 'tpi',
29-
'tr', 'uk', 'ur', 'uz', 'vi', 'xh', 'yi', 'zh', 'zh-CN', 'zh-HK', 'zh-SG', 'zh-TW', 'zu'
30-
]
31-
3231
# Init/load config file
3332
cli.script_name = os.path.splitext(os.path.basename(__file__))[0]
3433
cli.config_filename = f'{cli.script_name}.config.json'
@@ -68,7 +67,7 @@
6867
def parse_csv_langs(str) : return [lang.strip() for lang in str.split(',') if lang.strip()]
6968
include_arg = args.include_langs or cli.config_data.get('include_langs', '')
7069
exclude_arg = args.exclude_langs or cli.config_data.get('exclude_langs', '')
71-
target_locales = parse_csv_langs(include_arg) or default_target_locales
70+
target_locales = parse_csv_langs(include_arg) or cli.default_target_locales
7271
exclude_langs = set(parse_csv_langs(exclude_arg))
7372
target_locales = [lang for lang in target_locales if lang not in exclude_langs]
7473

chatgpt/googlegpt/utils/translate-en-messages.py

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'''
22
Name: translate-en-messages.py
3-
Version: 2026.2.10.23
3+
Version: 2026.2.10.24
44
Author: Adam Lui
55
Description: Translate en/messages.json to other locales
66
Homepage: https://github.com/adamlui/python-utils
@@ -17,18 +17,17 @@
1717

1818
cli = sns(
1919
name='translate-messages',
20-
urls=sns(jsdelivr='https://cdn.jsdelivr.net/gh/adamlui/python-utils')
20+
urls=sns(jsdelivr='https://cdn.jsdelivr.net/gh/adamlui/python-utils'),
21+
default_target_locales=[
22+
'af', 'am', 'ar', 'az', 'be', 'bem', 'bg', 'bn', 'bo', 'bs', 'ca', 'ceb', 'cs', 'cy', 'da', 'de', 'dv', 'dz', 'el',
23+
'en', 'en-GB', 'eo', 'es', 'et', 'eu', 'fa', 'fi', 'fo', 'fr', 'gd', 'gl', 'gu', 'haw', 'he', 'hi', 'hr', 'ht',
24+
'hu', 'hy', 'id', 'is', 'it', 'ja', 'ka', 'kab', 'kk', 'km', 'kn', 'ko', 'ku', 'ky', 'la', 'lb', 'lo', 'lt', 'lv',
25+
'mg', 'mi', 'mk', 'ml', 'mn', 'ms', 'mt', 'my', 'ne', 'nl', 'no', 'ny', 'pa', 'pap', 'pl', 'ps', 'pt', 'ro', 'ru',
26+
'rw', 'sg', 'si', 'sk', 'sl', 'sm', 'sn', 'so', 'sr', 'sv', 'sw', 'ta', 'te', 'tg', 'th', 'ti', 'tk', 'tn', 'tpi',
27+
'tr', 'uk', 'ur', 'uz', 'vi', 'xh', 'yi', 'zh', 'zh-CN', 'zh-HK', 'zh-SG', 'zh-TW', 'zu'
28+
]
2129
)
2230

23-
default_target_locales = [
24-
'af', 'am', 'ar', 'az', 'be', 'bem', 'bg', 'bn', 'bo', 'bs', 'ca', 'ceb', 'cs', 'cy', 'da', 'de', 'dv', 'dz', 'el',
25-
'en', 'en-GB', 'eo', 'es', 'et', 'eu', 'fa', 'fi', 'fo', 'fr', 'gd', 'gl', 'gu', 'haw', 'he', 'hi', 'hr', 'ht',
26-
'hu', 'hy', 'id', 'is', 'it', 'ja', 'ka', 'kab', 'kk', 'km', 'kn', 'ko', 'ku', 'ky', 'la', 'lb', 'lo', 'lt', 'lv',
27-
'mg', 'mi', 'mk', 'ml', 'mn', 'ms', 'mt', 'my', 'ne', 'nl', 'no', 'ny', 'pa', 'pap', 'pl', 'ps', 'pt', 'ro', 'ru',
28-
'rw', 'sg', 'si', 'sk', 'sl', 'sm', 'sn', 'so', 'sr', 'sv', 'sw', 'ta', 'te', 'tg', 'th', 'ti', 'tk', 'tn', 'tpi',
29-
'tr', 'uk', 'ur', 'uz', 'vi', 'xh', 'yi', 'zh', 'zh-CN', 'zh-HK', 'zh-SG', 'zh-TW', 'zu'
30-
]
31-
3231
# Init/load config file
3332
cli.script_name = os.path.splitext(os.path.basename(__file__))[0]
3433
cli.config_filename = f'{cli.script_name}.config.json'
@@ -68,7 +67,7 @@
6867
def parse_csv_langs(str) : return [lang.strip() for lang in str.split(',') if lang.strip()]
6968
include_arg = args.include_langs or cli.config_data.get('include_langs', '')
7069
exclude_arg = args.exclude_langs or cli.config_data.get('exclude_langs', '')
71-
target_locales = parse_csv_langs(include_arg) or default_target_locales
70+
target_locales = parse_csv_langs(include_arg) or cli.default_target_locales
7271
exclude_langs = set(parse_csv_langs(exclude_arg))
7372
target_locales = [lang for lang in target_locales if lang not in exclude_langs]
7473

0 commit comments

Comments
 (0)