3 #include <unordered_map>
7 #include <spdlog/spdlog.h>
28 }
catch (std::out_of_range &ex) {
29 spdlog::info(
"localisation.cpp - Failed to find localisation {0} key for currently selected language."
30 "Using key instead.", key);
42 std::ifstream dict(file, std::ios::in);
44 if (!dict.is_open()) {
45 spdlog::critical(
"localisation.cpp - Failed to load default language dictionary");
49 while (std::getline(dict, line)) {
50 sep_index = line.find_first_of(
'=');
52 std::string key = line.substr(0, sep_index);
54 std::string val = line.substr(sep_index + 1, line.length());
70 std::ifstream dict(file, std::ios::in);
72 if (!dict.is_open()) {
73 spdlog::critical(
"localisation.cpp - Failed to load current language dictionary");
77 while (std::getline(dict, line)) {
78 sep_index = line.find_first_of(
'=');
80 std::string key = line.substr(0, sep_index);
82 std::string val = line.substr(sep_index + 1, line.length());
One of the most importat classes in the whole project. Holds variables that define the state of the a...
static std::unique_ptr< app_workspace > & get_instance()
Get the instance app_workspace which is a singleton.
void init_labels()
This is called after localisation dictionary is loaded. After the dict is loaded arrays defined in ap...
std::unique_ptr< app_config > main_config
Application config loaded from app_config.conf (main config file).
const char * get_localized_text(const char *key)
Get the localized text object.
std::unordered_map< std::string, std::string > default_dict
int load_default_dict()
Loads default language dictionary.
std::unordered_map< std::string, std::string > current_dict
int load_current_dict()
Loads current language dictionary. This could be called with an action during runtime to change the a...