summaryrefslogtreecommitdiff
path: root/bot/src
diff options
context:
space:
mode:
authorgarder500 <jeremy27.clara22@gmail.com>2025-05-02 00:10:43 +0200
committergarder500 <jeremy27.clara22@gmail.com>2025-05-02 00:10:43 +0200
commit83298ee3aec687ba1c5f41fb7135e465869d4fe8 (patch)
treed4d54cd1f1cb8d6e355fee138cf0d460dd4b1b6f /bot/src
parentfe156854748a767aafc773748e1c4ecc9a701484 (diff)
Refactor la gestion des traductions : remplacement des maps par des unordered_maps pour améliorer les performances dans la fonction translate.
Diffstat (limited to 'bot/src')
-rw-r--r--bot/src/actions/delete.cpp2
-rw-r--r--bot/src/utils.cpp2
2 files changed, 2 insertions, 2 deletions
diff --git a/bot/src/actions/delete.cpp b/bot/src/actions/delete.cpp
index dbd9efe..da74bbf 100644
--- a/bot/src/actions/delete.cpp
+++ b/bot/src/actions/delete.cpp
@@ -1,7 +1,7 @@
#include "../../include/utils.hpp"
-const std::map<Lang, std::map<std::string, std::string>> error_messages_map = {
+const std::unordered_map<Lang, std::unordered_map<std::string, std::string>> error_messages_map = {
{Lang::en, {
{"error_no_messages", "No message to delete."},
{"error", "You need to wait a bit before deleting messages."},
diff --git a/bot/src/utils.cpp b/bot/src/utils.cpp
index 3ad1bad..a2ce928 100644
--- a/bot/src/utils.cpp
+++ b/bot/src/utils.cpp
@@ -218,7 +218,7 @@ namespace app
return Lang::en; // Default to English if no match is found
}
- std::string translate(const std::string &str, const std::string &locale, const std::map<Lang, std::map<std::string, std::string>> &array_translations, const std::unordered_map<std::string, std::string> &args)
+ std::string translate(const std::string &str, const std::string &locale, const std::unordered_map<Lang, std::unordered_map<std::string, std::string>> &array_translations, const std::unordered_map<std::string, std::string> &args)
{
Lang lang = get_available_locale(locale);
auto it = array_translations.find(lang);