all lang has been replaced

This commit is contained in:
2026-03-06 12:50:54 +01:00
parent 9e890c9d7c
commit 9e17b7db7b
6 changed files with 32 additions and 91 deletions
+9 -1
View File
@@ -48,7 +48,8 @@
}, },
"embed": { "embed": {
"post": "Spoilers and vote length anonymizer for fair review!\n## Post Data:\n**Subreddit:** {0}\n**Post upvotes:** ||`{1:>6}`||\n**Moderator votes:** ||`{2:>6}`||\n**Media type:** `{3}`\n## Listing Data:\n**Added by:** human: {4} | bot: {5}\n**Approved:** {6}", "post": "Spoilers and vote length anonymizer for fair review!\n## Post Data:\n**Subreddit:** {0}\n**Post upvotes:** ||`{1:>6}`||\n**Moderator votes:** ||`{2:>6}`||\n**Media type:** `{3}`\n## Listing Data:\n**Added by:** human: {4} | bot: {5}\n**Approved:** {6}",
"post_removed": "## Removed by `{0}`\n**Reason:** {1}" "post_removed": "## Removed by `{0}`\n**Reason:** {1}",
"removed_square_brackets": "[REMOVED] {0}"
}, },
"update_post": "Updated post with URL \"<{0}>\"!", "update_post": "Updated post with URL \"<{0}>\"!",
"help_404": "Reddit help file not found, someone likely deleted it.\n-# Hint: You can find the official help text at https://github.com/ByteDice/ByteDiceAssistant in `re_help.md`.\n**CAUTION:** The official help file may contain incorrect information if you're not using the official bot by Byte Dice.", "help_404": "Reddit help file not found, someone likely deleted it.\n-# Hint: You can find the official help text at https://github.com/ByteDice/ByteDiceAssistant in `re_help.md`.\n**CAUTION:** The official help file may contain incorrect information if you're not using the official bot by Byte Dice.",
@@ -86,5 +87,12 @@
"mandatory_response": "Mandatory response message, please ignore.", "mandatory_response": "Mandatory response message, please ignore.",
"cmd_404": "No command \"{0}\" found!\nHint: Try `/help` without any arguments or `/help <category>`" "cmd_404": "No command \"{0}\" found!\nHint: Try `/help` without any arguments or `/help <category>`"
}, },
"re": {
"suffix": "^(I am not an AI, I am just a bot. This action was performed automatically by the way. You can report bugs and view my source code [here](https://github.com/ByteDice/ByteDiceAssistant)!)",
"add": "Successfully added your post to the weekly art submissions! Thank you for participating!",
"exists": "Couldn't add this post to the submissions! Luckily, it's already there! Thank you for participating!",
"mod_add": "[MOD ACTION] Successfully added this post to the weekly art submissions!",
"mod_unremove": "[MOD ACTION] Successfully un-removed this post from the weekly art submissions!"
},
"lang_load": "Successfully loaded the english language file!" "lang_load": "Successfully loaded the english language file!"
} }
-78
View File
@@ -1,78 +0,0 @@
{
//"dc_btn_approve": "Approve",
//"dc_btn_remove": "Remove",
//"dc_btn_unapprove": "Disapprove",
//"dc_btn_unremove": "Restore",
//"dc_btn_unvote": "Un-vote",
//"dc_btn_vote": "Vote",
//"dc_msg_8-ball_answer": "**8-ball Question:** {0}\n**Answer:** {1}",
//"dc_msg_add_to_data": "Added your server to my data! Thanks for letting me steal it! (/s)",
//"dc_msg_bound_channel": "Successfully added channel ID `{0}` to the database!",
//"dc_msg_cmd_404": "No command \"{0}\" found!\nHint: Try `/help` without any arguments or `/help <category>`",
//"dc_msg_corrupted_data": "Oopsies `(。>\\\\<)`. It looks like my data i-is \\**sob*\\*... c-corrupted!",
//"dc_msg_data_server_404": "This server is not in the data!\n Hint: Run the command `/database AddServer` inside of a Discord server (requires administrator permission).",
//"dc_msg_dm_python_err_socket": "Unknown internal Python error occurred: Websocket response error",
//"dc_msg_dm_python_err": "Unknown internal Python Error:\n```\n{0}\n```",
//"dc_msg_embed_default_embed_desc": "Default english embed description.",
//"dc_msg_embed_re_post": "Spoilers and vote length anonymizer for fair review!\n## Post Data:\n**Subreddit:** {0}\n**Post upvotes:** ||`{1:>6}`||\n**Moderator votes:** ||`{2:>6}`||\n**Media type:** `{3}`\n## Listing Data:\n**Added by:** human: {4} | bot: {5}\n**Approved:** {6}",
//"dc_msg_embed_re_removed": "## Removed by `{0}`\n**Reason:** {1}",
//"dc_msg_err_trace": "Unknown error!\nError trace: {0}",
//"dc_msg_failed_shorturl_conversion": "Couldn't convert to shortURL: Invalid Reddit URL format.",
//"dc_msg_mandatory_response": "Mandatory response message, please ignore.",
//"dc_msg_no_perms": "Missing permission in that server: {0}",
//"dc_msg_not_in_guild": "I am not a part of that guild.",
//"dc_msg_owner_data_save_complete": "Saving data... Done!",
//"dc_msg_owner_data_save": "Saving data...",
//"dc_msg_owner_shutdown": "Shutting down...",
//"dc_msg_owner_shutdown_failed_confirmation": "Failed to shut down: Invalid confirmation.",
//"dc_msg_re_already_voted": "Couldn't cast a vote: You have already voted on this post!",
//"dc_msg_re_also_approved": "Also approved it!",
//"dc_msg_re_data_corrupted": "Post URL \"<{0}>\" not found: Post data is corrupted!\n Full details: Could not find key \"posts\" in data file \"re_data.json\"",
"dc_msg_re_help_removed": "Reddit help file not found, someone likely deleted it.\n Hint: You can find the official help text at https://github.com/ByteDice/ByteDiceAssistant in `re_help.md`.\n**CAUTION:** The official help file may contain incorrect information if you're not using the official bot by Byte Dice.",
//"dc_msg_re_permdeny_not_re_mod": "Permission denied: You are not a moderator of the subreddit(s) {0}",
//"dc_msg_re_post_404": "Post URL \"<{0}>\" not found: Post doesn't exist in the data!\n Hint: Run the command `/re_addpost [URL]` in a Discord channel or `u/ByteDiceAssistant add_post` in a Reddit post.",
//"dc_msg_re_post_add_success": "Added post with URL \"<{0}>\"!",
//"dc_msg_re_post_approve_remove": "Couldn't approve the post because it has been removed!",
//"dc_msg_re_post_approve_success": "Successfully approved the post!",
//"dc_msg_re_post_disapprove_success": "Successfully disapproved the post!",
//"dc_msg_re_post_remove_success": "Successfully removed post with URL \"<{0}>\"!",
//"dc_msg_re_post_unremove_success": "Successfully restored post with URL \"<{0}>\"!",
//"dc_msg_re_post_update_success": "Updated post with URL \"<{0}>\"!",
//"dc_msg_re_post_vote_removed_post": "Couldn't [vote / un-vote] the post because it has been removed!",
"dc_msg_re_posts_channel_404": "Could not find `re_posts_channel` in data!\nHint: Run `/database RedditChannel` in a (preferably read-only) channel (requires administrator permission).",
//"dc_msg_re_vote_err": "Failed to [vote / un-vote]: Unknown internal error.",
//"dc_msg_re_vote_mod_success": "Successfully voted (as moderator vote)!",
//"dc_msg_re_vote_remove_havent": "Couldn't remove your vote: You haven't voted on this post yet!",
//"dc_msg_re_vote_remove_success": "Successfully removed vote!",
//"dc_msg_re_vote_success": "Successfully voted!",
"dc_msg_reload_cfg_python_fail": "Failed to reload configs: Failed-type response from Python.",
"dc_msg_reload_cfg_success": "Successfully reloaded the configs!\nNew configs:\n```\n{0}\n```",
"dc_msg_removed_square_brackets": "[REMOVED] {0}",
//"dc_msg_shorturl": "ShortURL: <{0}>",
//"dc_msg_update_add": "{0}Adding new posts...",
//"dc_msg_update_done": "{0}Done!",
//"dc_msg_update_editing": "{0}Editing updated posts...",
//"dc_msg_update_fetch": "{0}Fetching new posts & updating data file...",
//"dc_msg_update_parse": "{0}Parsing messages to JSON...",
//"dc_msg_update_read": "{0}Reading messages in <#{1}>...",
//"dc_msg_update_removing_dupe": "{0}Removing duplicate posts...",
//"dc_msg_update_removing_old": "{0}Removing old posts (threshold: {1}d)...",
//"dc_msg_update_removing": "{0}Removing removed posts...",
//"dc_msg_whoami": "**Bot \"owner\":** {0}\n**BK moderator:** {1}",
//"dc_msg_wwrps_already_submitted": "You can't compete against yourself! Please wait until another player has submitted their RPS.",
//"dc_msg_wwrps_anon": "[Anonymous]",
//"dc_msg_wwrps_draw": "DRAW",
//"dc_msg_wwrps_fight": "### {0} (P1) vs {1} (P2)...\n## {2}\n**P1:** {3}\n**P2:** {4}",
//"dc_msg_wwrps_not_in_data": "Could not find `wwrps_channel` in data!\nHint: Run `/database WWRPSChannel` in a channel (requires administrator permission).",
//"dc_msg_wwrps_left_win": "P1 WINS",
//"dc_msg_wwrps_right_win": "P2 WINS",
//"dc_msg_wwrps_submitting": "Submitting your RPS... Please wait for another contestant to compete against you.",
//"log_lang_load_success": "Successfully loaded the english language file!",
//"none": "None",
"py_re_response_suffix": "^(I am not an AI, I am just a bot. This action was performed automatically by the way. You can report bugs and view my source code [here](https://github.com/ByteDice/ByteDiceAssistant)!)",
"py_re_response_weekly_add": "Successfully added your post to the weekly art submissions! Thank you for participating!",
"py_re_response_weekly_exists": "Couldn't add this post to the submissions! Luckily, it's already there! Thank you for participating!",
"py_re_response_weekly_mod_add": "[MOD ACTION] Successfully added this post to the weekly art submissions!",
"py_re_response_weekly_mod_unremove": "[MOD ACTION] Successfully un-removed this post from the weekly art submissions!",
//"success": "Success!"
}
+1 -1
View File
@@ -283,7 +283,7 @@ pub fn make_removed_embed(lang: &Lang, post_data: &Value, url: &str, ephemeral:
let json_encoded = trim_compress_and_encode_json(post_data); let json_encoded = trim_compress_and_encode_json(post_data);
return EmbedOptions { return EmbedOptions {
title: Some(lang.get("dc_msg_removed_square_brackets", &[post_data["post_data"]["title"].clone().to_string()])), title: Some(lang.get("dc.re.embed.removed_square_brackets", &[post_data["post_data"]["title"].clone().to_string()])),
desc: format!("{}\n\n{}{}{}", desc, JSON_TEXT_START, json_encoded, JSON_TEXT_END), desc: format!("{}\n\n{}{}{}", desc, JSON_TEXT_START, json_encoded, JSON_TEXT_END),
col: Some(REMOVED_DC_COL), col: Some(REMOVED_DC_COL),
url: Some(url.to_string()), url: Some(url.to_string()),
+16 -5
View File
@@ -28,11 +28,22 @@ def py_error(*args: str):
def lang(k: str) -> str: def lang(k: str) -> str:
if G_LANG == {}: return lang_from_arr(k.split("."))
py_error("Language must be initialized before use!")
t = G_LANG.get(k)
if t is None: py_error(f"Key not found in language \"{G_LANG_NAME}\": {k}") def lang_from_arr(path: list[str]) -> str:
return str(t) if G_LANG == {}: py_error("Language must be initialized before use!")
str_path = ".".join(path)
search = G_LANG
for i in path:
r = search.get(i) # type: ignore
if r is None: return str_path
elif r is str: return str(r)
else: search = r # type: ignore
return str_path
def init_lang(lang_name: str): def init_lang(lang_name: str):
+1 -1
View File
@@ -19,7 +19,7 @@ async def main():
await bot.set_args(args) # type: ignore await bot.set_args(args) # type: ignore
py_print("Fetching language file...") py_print("Fetching language file...")
init_lang(lang_name) # type: ignore init_lang(lang_name) # type: ignore
py_print(f"[IMPORTANT] The below message is a test message, it should be written in the language you've selected\nTest message: {lang('log_lang_load_success')}") py_print(f"[IMPORTANT] The below message is a test message, it should be written in the language you've selected\nTest message: {lang('lang_load')}")
except NameError: except NameError:
py_print("No command args or language name found from Rust. Don't worry though, we have backup in place.") py_print("No command args or language name found from Rust. Don't worry though, we have backup in place.")
init_lang("en") init_lang("en")
+5 -5
View File
@@ -69,18 +69,18 @@ async def bk_week_add(mention: models.Comment, bot: botPy.Bot):
bd = bot.data[botPy.RE_DATA_POSTS] bd = bot.data[botPy.RE_DATA_POSTS]
if short_url not in bd: if short_url not in bd:
if not is_mod: r = lang("py_re_response_weekly_add") if not is_mod: r = lang("re.add")
if is_mod: r = lang("py_re_response_weekly_mod_add") if is_mod: r = lang("re.mod_add")
else: else:
if bd[short_url]["removed"]["removed"] and is_mod: if bd[short_url]["removed"]["removed"] and is_mod:
r = lang("py_re_response_weekly_mod_unremove") r = lang("re.mod_unremove")
elif not bd[short_url]["removed"]["removed"]: elif not bd[short_url]["removed"]["removed"]:
r = lang("py_re_response_weekly_exists") r = lang("re.exists")
await posts.add_post_url(bot, short_url) await posts.add_post_url(bot, short_url)
if r != "": if r != "":
await mention.reply(r + "\n\n" + lang("py_re_response_suffix")) await mention.reply(r + "\n\n" + lang("re.suffix"))
if bot.args["dev"]: py_print("Responded to mention.") if bot.args["dev"]: py_print("Responded to mention.")
elif bot.args["dev"]: py_print("Response is empty.") elif bot.args["dev"]: py_print("Response is empty.")
await mention.mark_read() await mention.mark_read()