Skip to content

Commit

Permalink
chg: add fallback to english
Browse files Browse the repository at this point in the history
  • Loading branch information
hiddify-com committed Jul 11, 2024
1 parent 42180d4 commit 4f2371f
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions hiddifypanel_bot/utils/translation.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
import i18n
def setup_translation():
import i18n
import hiddifypanel_bot
i18n.load_path.append(hiddifypanel_bot.__path__[0]+'/translations')
i18n.set('file_format', 'json')
i18n.set('skip_locale_root_data',True)
i18n.set('filename_format', '{locale}.{format}')
i18n.set('placeholder_delimiter','$')
i18n.set('fallback','en')
i18n.set('on_missing_translation',__on_missing__)
i18n.set('placeholder_delimiter','$')

def __on_missing__(key,locale,**kwargs):
if locale!='en':
return i18n.t(key,'en',**kwargs)
return key

0 comments on commit 4f2371f

Please sign in to comment.