Platformer
Platformer
LocaleManager.hpp
1 #ifndef LOCALE_MANAGER_HPP
2 #define LOCALE_MANAGER_HPP
3 
4 #include <string>
5 #include <unordered_map>
6 
12  public:
14  static LocaleManager& instance();
15 
20  static std::string Lookup(
21  const std::string& key);
22 
24  LocaleManager(const LocaleManager&) = delete;
25 
27  LocaleManager& operator=(const LocaleManager&) = delete;
28 
29  private:
32  const std::string& locale);
33 
36 
38  std::unordered_map<std::string, std::string> strings_;
39 };
40 
41 #endif
This class manages the localization of our game as a singleton.
Definition: LocaleManager.hpp:11
LocaleManager(const LocaleManager &)=delete
Stop the compiler from generating methods to copy the object.
LocaleManager & operator=(const LocaleManager &)=delete
Stop the compiler from generating methods to copy the object.
static std::string Lookup(const std::string &key)
Looks up the given key in the translation map.
Definition: LocaleManager.cpp:14
~LocaleManager()
Destructs a LocaleManager.
Definition: LocaleManager.cpp:12
std::unordered_map< std::string, std::string > strings_
The translation key map.
Definition: LocaleManager.hpp:38
static LocaleManager & instance()
The singleton instance of the LocaleManager.
Definition: LocaleManager.cpp:5