Air-Trap 1.0.0
A multiplayer R-Type clone game engine built with C++23 and ECS architecture
Loading...
Searching...
No Matches
TranslationManager.hpp
Go to the documentation of this file.
1/*
2** EPITECH PROJECT, 2025
3** Air-Trap
4** File description:
5** TranslationManager - Handles game translations
6*/
7
8#ifndef TRANSLATIONMANAGER_HPP_
9#define TRANSLATIONMANAGER_HPP_
10
11#include <string>
12#include <unordered_map>
13#include <fstream>
14#include "Core/Settings.hpp"
15#include "RType/Logger.hpp"
16
17namespace rtp::client
18{
24 public:
25 TranslationManager() = default;
26
32 bool loadLanguage(Language language);
33
39 std::string get(const std::string& key) const;
40
48 template<typename... Args>
49 std::string getf(const std::string& key, Args&&... args) const {
50 std::string format = get(key);
51 return format;
52 }
53
55
56 private:
57 std::unordered_map<std::string,
58 std::string> _translations;
61 std::string getLanguageFilePath(Language lang) const;
62 };
63} // namespace Client::Core
64
65#endif /* !TRANSLATIONMANAGER_HPP_ */
Logger declaration with support for multiple log levels.
Manages game translations for all UI elements.
std::string getLanguageFilePath(Language lang) const
Get file path for a given language.
std::string get(const std::string &key) const
Get translated string for a key.
std::unordered_map< std::string, std::string > _translations
Map of translation keys to translated strings.
bool loadLanguage(Language language)
Load translations for a specific language.
std::string getf(const std::string &key, Args &&... args) const
Get translated string with format arguments.
Language _currentLanguage
Currently loaded language.
R-Type client namespace.
Language
Supported languages.
Definition Settings.hpp:33