4#include <nlohmann/json.hpp>
13class LanguageStrings {
25 static LanguageStrings&
the();
30 static std::vector<Language>
const&
languages() {
return s_languages; }
44 std::string_view
get_string(std::string_view key)
const;
47 static std::unique_ptr<LanguageStrings> s_instance;
48 static std::vector<Language> s_languages;
58 std::string_view m_current_language_id;
59 nlohmann::json m_strings;
66#define LS(key) (Cluedo::LanguageStrings::the().get_string((key)))
75#define CSTR(s) (std::string { (s) }.c_str())
Definition LanguageStrings.hpp:13
static LanguageStrings & the()
Definition LanguageStrings.cpp:22
std::string_view current_language_id() const
Definition LanguageStrings.hpp:34
void set_language(std::string_view id)
Definition LanguageStrings.cpp:31
static std::vector< Language > const & languages()
Definition LanguageStrings.hpp:30
std::string_view get_string(std::string_view key) const
Definition LanguageStrings.cpp:47
A struct that contains the data of a language.
Definition LanguageStrings.hpp:16
std::string_view id
An identifier used for the language.
Definition LanguageStrings.hpp:17
std::string_view data
The JSON data of the language.
Definition LanguageStrings.hpp:19
std::string_view name
The name of the language.
Definition LanguageStrings.hpp:18