| 100 | } |
| 101 | |
| 102 | void StringTable::ReadJson(json_t& root) |
| 103 | { |
| 104 | Guard::Assert(root.is_object(), "StringTable::ReadJson expects parameter root to be object"); |
| 105 | |
| 106 | // We trust the JSON type of root is object |
| 107 | auto jsonStrings = root["strings"]; |
| 108 | |
| 109 | for (auto& [key, jsonLanguages] : jsonStrings.items()) |
| 110 | { |
| 111 | auto stringId = ParseStringId(key); |
| 112 | if (stringId != ObjectStringID::unknown) |
| 113 | { |
| 114 | for (auto& [locale, jsonString] : jsonLanguages.items()) |
| 115 | { |
| 116 | auto langId = LanguageGetIDFromLocale(locale.c_str()); |
| 117 | if (langId != LANGUAGE_UNDEFINED) |
| 118 | { |
| 119 | auto string = Json::GetString(jsonString); |
| 120 | SetString(stringId, langId, string); |
| 121 | } |
| 122 | } |
| 123 | } |
| 124 | } |
| 125 | Sort(); |
| 126 | } |
| 127 | |
| 128 | std::string StringTable::GetString(ObjectStringID id) const |
| 129 | { |
nothing calls this directly
no test coverage detected