Skip to content

Commit 5be84c3

Browse files
committed
Deleted no-longer needed try/except
1 parent e6dcf4f commit 5be84c3

2 files changed

Lines changed: 6 additions & 14 deletions

File tree

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

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,9 @@ def get_msgs(cli: sn, lang_code: str = 'en') -> sn:
6666
Path(__file__).parent.parent / 'data/_locales/en/messages.json'))
6767

6868
if not lang_code.startswith('en'): # fetch non-English msgs from jsDelivr
69-
try: # check if terminal supports 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
72-
return sn(**msgs) # en ones
73-
except Exception as err:
74-
log.debug(f'Failed to fetch non-Latin locales: {err}')
75-
69+
import non_latin_locales
70+
if lang_code.split('_')[0] in non_latin_locales and not env.can_render_non_latin_scripts(): # type: ignore
71+
return sn(**msgs) # EN ones cuz non-Latin not supported
7672
msg_base_url = f'{jsdelivr.create_commit_url(cli, cli.commit_hashes.locales)}/src/remove_json_keys/data/_locales'
7773
msg_url = f'{msg_base_url}/{lang_code}/messages.json'
7874
for attempt in range(3):

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

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -98,13 +98,9 @@ def get_msgs(cli: sn, lang_code: str = 'en') -> sn:
9898
Path(__file__).parent.parent / 'data/_locales/en/messages.json'))
9999

100100
if not lang_code.startswith('en'): # fetch non-English msgs from jsDelivr
101-
try: # check if terminal supports 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
104-
return sn(**msgs) # en ones
105-
except Exception as err:
106-
log.debug(f'Failed to fetch non-Latin locales: {err}')
107-
101+
import non_latin_locales
102+
if lang_code.split('_')[0] in non_latin_locales and not env.can_render_non_latin_scripts(): # type: ignore
103+
return sn(**msgs) # EN ones cuz non-Latin not supported
108104
msg_base_url = f'{jsdelivr.create_commit_url(cli, cli.commit_hashes.locales)}/src/translate_messages/data/_locales'
109105
msg_url = f'{msg_base_url}/{lang_code}/messages.json'
110106
for attempt in range(3):

0 commit comments

Comments
 (0)