forked from tibue99/ezcord
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
65 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ venv | |
*.db | ||
*.log | ||
*.ini | ||
*.json | ||
embeds.json | ||
|
||
# Packaging | ||
build/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"times": { | ||
"min": "Minute", | ||
"sec": "Sekunde", | ||
"hour": "Stunde", | ||
"day": "Tag" | ||
}, | ||
"bot": { | ||
"error": "Der folgende Fehler ist aufgetreten: {}", | ||
"cooldown": "Versuche es {} erneut.", | ||
"no_perm_title": "Fehlende Berechtigung", | ||
"no_perm_desc": "Mir fehlen die folgenden Berechtigungen, um diesen Befehl auszuführen." | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"times": { | ||
"min": "minute", | ||
"sec": "second", | ||
"hour": "hour", | ||
"day": "day" | ||
}, | ||
"bot": { | ||
"error": "The following error occurred: {}", | ||
"cooldown": "Try again {}.", | ||
"no_perm_title": "Missing permission", | ||
"no_perm_desc": "I'm missing the following permissions to execute this command." | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import json | ||
import os | ||
from functools import cache | ||
from pathlib import Path | ||
|
||
|
||
@cache | ||
def load_txt(language: str) -> dict: | ||
"""Load default language files and check if the user provided custom language files.""" | ||
|
||
lang = {} | ||
parent = Path(__file__).parent.absolute() | ||
for element in os.scandir(parent): | ||
if not element.is_file() or not element.name.endswith(f"{language}.json"): | ||
continue | ||
|
||
with open(os.path.join(parent, f"{language}.json"), encoding="utf-8") as file: | ||
lang = json.load(file) | ||
break | ||
|
||
# check if the user has a custom language file | ||
for root, directories, files in os.walk(os.getcwd()): | ||
for filename in files: | ||
if filename != f"ez_{language}.json": | ||
continue | ||
|
||
path = os.path.join(root, filename) | ||
with open(path, encoding="utf-8") as user_file: | ||
user_dic = json.load(user_file) | ||
for key, value in user_dic.items(): | ||
lang[key] = value | ||
|
||
return lang |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters