Skip to content

Commit eae0efa

Browse files
committed
1 parent e19e49e commit eae0efa

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

chromium/utils/translate-en-messages.py

Lines changed: 8 additions & 2 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.16
3+
Version: 2026.2.10.17
44
Author: Adam Lui
55
Description: Translate en/messages.json to other locales
66
Homepage: https://github.com/adamlui/python-utils
@@ -13,8 +13,14 @@
1313
import os, json
1414
from sys import stdout
1515
from translate import Translator
16+
from types import SimpleNamespace
1617
from urllib.request import urlopen
1718

19+
cli = SimpleNamespace(
20+
name='translate-messages',
21+
urls=SimpleNamespace(jsdelivr='https://cdn.jsdelivr.net/gh/adamlui/python-utils')
22+
)
23+
1824
provider = ''
1925
default_target_locales = [
2026
'af', 'am', 'ar', 'az', 'be', 'bem', 'bg', 'bn', 'bo', 'bs', 'ca', 'ceb', 'cs', 'cy', 'da', 'de', 'dv', 'dz', 'el',
@@ -49,7 +55,7 @@
4955
print(f'Config already exists at {config_path}')
5056
else:
5157
try: # try to fetch template from jsDelivr
52-
jsd_url = f'https://cdn.jsdelivr.net/gh/adamlui/python-utils/translate-messages/{config_filename}'
58+
jsd_url = f'{cli.urls.jsdelivr}/{cli.name}/{config_filename}'
5359
with urlopen(jsd_url) as resp:
5460
if resp.status == 200 : config_data = json.loads(resp.read().decode('utf-8'))
5561
except Exception : pass

firefox/utils/translate-en-messages.py

Lines changed: 8 additions & 2 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.16
3+
Version: 2026.2.10.17
44
Author: Adam Lui
55
Description: Translate en/messages.json to other locales
66
Homepage: https://github.com/adamlui/python-utils
@@ -13,8 +13,14 @@
1313
import os, json
1414
from sys import stdout
1515
from translate import Translator
16+
from types import SimpleNamespace
1617
from urllib.request import urlopen
1718

19+
cli = SimpleNamespace(
20+
name='translate-messages',
21+
urls=SimpleNamespace(jsdelivr='https://cdn.jsdelivr.net/gh/adamlui/python-utils')
22+
)
23+
1824
provider = ''
1925
default_target_locales = [
2026
'af', 'am', 'ar', 'az', 'be', 'bem', 'bg', 'bn', 'bo', 'bs', 'ca', 'ceb', 'cs', 'cy', 'da', 'de', 'dv', 'dz', 'el',
@@ -49,7 +55,7 @@
4955
print(f'Config already exists at {config_path}')
5056
else:
5157
try: # try to fetch template from jsDelivr
52-
jsd_url = f'https://cdn.jsdelivr.net/gh/adamlui/python-utils/translate-messages/{config_filename}'
58+
jsd_url = f'{cli.urls.jsdelivr}/{cli.name}/{config_filename}'
5359
with urlopen(jsd_url) as resp:
5460
if resp.status == 200 : config_data = json.loads(resp.read().decode('utf-8'))
5561
except Exception : pass

0 commit comments

Comments
 (0)