Blane187 commited on
Commit
51d4d2f
1 Parent(s): 9fd0bbb

Delete i18n.py

Browse files
Files changed (1) hide show
  1. i18n.py +0 -28
i18n.py DELETED
@@ -1,28 +0,0 @@
1
- import locale
2
- import json
3
- import os
4
-
5
-
6
- def load_language_list(language):
7
- with open(f"./i18n/{language}.json", "r", encoding="utf-8") as f:
8
- language_list = json.load(f)
9
- return language_list
10
-
11
-
12
- class I18nAuto:
13
- def __init__(self, language=None):
14
- if language in ["Auto", None]:
15
- language = locale.getdefaultlocale()[
16
- 0
17
- ] # getlocale can't identify the system's language ((None, None))
18
- if not os.path.exists(f"./i18n/{language}.json"):
19
- language = "it_IT"
20
- self.language = language
21
- # print("Use Language:", language)
22
- self.language_map = load_language_list(language)
23
-
24
- def __call__(self, key):
25
- return self.language_map.get(key, key)
26
-
27
- def print(self):
28
- print("Use Language:", self.language)