forked from AnonymousX1025/AnonXMusic
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path__init__.py
40 lines (30 loc) · 1.03 KB
/
__init__.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import os
from typing import List
import yaml
languages = {}
commands = {}
def get_command(value: str) -> List:
return commands["command"][value]
def get_string(lang: str):
return languages[lang]
for filename in os.listdir(r"./strings"):
if filename.endswith(".yml"):
language_name = filename[:-4]
commands[language_name] = yaml.safe_load(
open(r"./strings/" + filename, encoding="utf8")
)
for filename in os.listdir(r"./strings/langs/"):
if "en" not in languages:
languages["en"] = yaml.safe_load(
open(r"./strings/langs/en.yml", encoding="utf8")
)
if filename.endswith(".yml"):
language_name = filename[:-4]
if language_name == "en":
continue
languages[language_name] = yaml.safe_load(
open(r"./strings/langs/" + filename, encoding="utf8")
)
for item in languages["en"]:
if item not in languages[language_name]:
languages[language_name][item] = languages["en"][item]