diff options
| author | ilotterytea <iltsu@alright.party> | 2024-04-21 15:31:00 +0500 |
|---|---|---|
| committer | ilotterytea <iltsu@alright.party> | 2024-04-21 15:31:00 +0500 |
| commit | d3cad81b14f41d1345d39c8bc0a1cb556bca4f09 (patch) | |
| tree | 10bc5836994be45ba3ca62f124a175a64ffbb13c /src/localization/localization.hpp | |
| parent | 9f3b2ea3b4391f4cbbe28463b917936c639491ec (diff) | |
feat: localizator
Diffstat (limited to 'src/localization/localization.hpp')
| -rw-r--r-- | src/localization/localization.hpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/localization/localization.hpp b/src/localization/localization.hpp new file mode 100644 index 0000000..d1ee2af --- /dev/null +++ b/src/localization/localization.hpp @@ -0,0 +1,32 @@ +#pragma once + +#include <optional> +#include <string> +#include <unordered_map> +#include <vector> + +#include "line_id.hpp" + +namespace bot { + namespace loc { + class Localization { + public: + Localization(const std::string &folder_path); + ~Localization() = default; + + std::optional<std::string> get_localized_line( + const std::string &locale_id, const LineId &line_id); + + std::optional<std::string> get_formatted_line( + const std::string &locale_id, const LineId &line_id, + const std::vector<std::string> &args); + + private: + std::unordered_map<LineId, std::string> load_from_file( + const std::string &file_path); + std::unordered_map<std::string, std::unordered_map<LineId, std::string>> + localizations; + }; + } + +} |
