Skip to content

Commit e83918c

Browse files
committed
Used non-latin-locales pkg
1 parent 36e5d16 commit e83918c

4 files changed

Lines changed: 6 additions & 6 deletions

File tree

remove-json-keys/pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ dependencies = [
2121
"colorama>=0.4.6,<1 ; platform_system == 'Windows'",
2222
"find-project-root>=1.0.1,<",
2323
"json5>=0.9.0,<1",
24+
"non-latin-locales>=1.0.0,<2",
2425
"ucs-detect>=2.0.2,<3",
2526
]
2627
requires-python = ">=3.8,<4"

remove-json-keys/src/remove_json_keys/lib/language.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,8 @@ def get_msgs(cli: sn, lang_code: str = 'en') -> sn:
6767

6868
if not lang_code.startswith('en'): # fetch non-English msgs from jsDelivr
6969
try: # check if terminal supports non-Latin scripts
70-
non_latin_locales = data.json.read(url.get(
71-
f'{cli.urls.jsdelivr}@{cli.commit_hashes.data}/assets/data/non_latin_locales.json'))
72-
if lang_code.split('_')[0] in non_latin_locales and not env.can_render_non_latin_scripts():
70+
import non_latin_locales
71+
if lang_code.split('_')[0] in non_latin_locales and not env.can_render_non_latin_scripts(): # type: ignore
7372
return sn(**msgs) # en ones
7473
except Exception as err:
7574
log.debug(f'Failed to fetch non-Latin locales: {err}')

translate-messages/pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ dependencies = [
2121
"colorama>=0.4.6,<1 ; platform_system == 'Windows'",
2222
"find-project-root>=1.0.1,<2",
2323
"json5>=0.9.0,<1",
24+
"non-latin-locales>=1.0.0,<2",
2425
"translate>=3.8.0,<4",
2526
"ucs-detect>=2.0.2,<3",
2627
]

translate-messages/src/translate_messages/lib/language.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,8 @@ def get_msgs(cli: sn, lang_code: str = 'en') -> sn:
9999

100100
if not lang_code.startswith('en'): # fetch non-English msgs from jsDelivr
101101
try: # check if terminal supports non-Latin scripts
102-
non_latin_locales = data.json.read(url.get(
103-
f'{cli.urls.jsdelivr}@{cli.commit_hashes.data}/assets/data/non_latin_locales.json'))
104-
if lang_code.split('_')[0] in non_latin_locales and not env.can_render_non_latin_scripts():
102+
import non_latin_locales
103+
if lang_code.split('_')[0] in non_latin_locales and not env.can_render_non_latin_scripts(): # type: ignore
105104
return sn(**msgs) # en ones
106105
except Exception as err:
107106
log.debug(f'Failed to fetch non-Latin locales: {err}')

0 commit comments

Comments
 (0)