diff options
| -rw-r--r-- | bot/src/localization/localization.cpp | 11 | ||||
| -rw-r--r-- | bot/src/localization/localization.hpp | 2 |
2 files changed, 13 insertions, 0 deletions
diff --git a/bot/src/localization/localization.cpp b/bot/src/localization/localization.cpp index 2742602..48c6d52 100644 --- a/bot/src/localization/localization.cpp +++ b/bot/src/localization/localization.cpp @@ -3,6 +3,7 @@ #include <algorithm> #include <filesystem> #include <fstream> +#include <iterator> #include <map> #include <nlohmann/json.hpp> #include <optional> @@ -128,5 +129,15 @@ namespace bot { return line; } + + const std::vector<std::string> Localization::get_loaded_localizations() + const { + std::vector<std::string> output; + std::transform(this->localizations.begin(), this->localizations.end(), + std::back_inserter(output), + [](const auto &x) { return x.first; }); + + return output; + } } } diff --git a/bot/src/localization/localization.hpp b/bot/src/localization/localization.hpp index 4626c68..55b56a0 100644 --- a/bot/src/localization/localization.hpp +++ b/bot/src/localization/localization.hpp @@ -26,6 +26,8 @@ namespace bot { const command::Request &request, const LineId &line_id, const std::vector<std::string> &args) const; + const std::vector<std::string> get_loaded_localizations() const; + private: std::unordered_map<LineId, std::string> load_from_file( const std::string &file_path); |
