diff options
| author | ilotterytea <iltsu@alright.party> | 2024-12-14 23:12:22 +0500 |
|---|---|---|
| committer | ilotterytea <iltsu@alright.party> | 2024-12-14 23:12:22 +0500 |
| commit | 79c39906131bb72780da96ccc6eb43524dec3350 (patch) | |
| tree | 9f8a4e6b3f5d858ad20a3cbaeaec1894f352463a /bot | |
| parent | b96792078a350b02c6d3e650bbe5c42b665bee7e (diff) | |
feat: a method for getting loaded localizations
Diffstat (limited to 'bot')
| -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); |
