MCPcopy Create free account
hub / github.com/TactilityProject/Tactility / TextResources

Class TextResources

Tactility/Include/Tactility/i18n/TextResources.h:14–47  ·  view source on GitHub ↗

* Holds localized text data. * * It is used with data generated from Translations/ with the python generation scripts. * It's used with a header file that specifies the indexes, and generated text files (.i18n) */

Source from the content-addressed store, hash-verified

12 * It's used with a header file that specifies the indexes, and generated text files (.i18n)
13 */
14class TextResources {
15
16 std::vector<std::string> data;
17 std::string path;
18 static std::string ERROR_RESULT;
19
20public:
21 /**
22 * @param[in] path
23 */
24 TextResources(const std::string& path) : path(path) {}
25
26 const std::string& get(const int index) const {
27 if (index < data.size()) {
28 return data[index];
29 } else {
30 return ERROR_RESULT;
31 }
32 }
33
34 template <typename EnumType>
35 const std::string& get(EnumType value) const { return get(static_cast<int>(value)); }
36
37 const std::string& operator[](const int index) const { return get(index); }
38
39 template <typename EnumType>
40 const std::string& operator[](const EnumType index) const { return get(index); }
41
42 /**
43 * Load or reload an i18n file with the system's current locale settings.
44 * @return true on success
45 */
46 bool load();
47};
48
49}

Callers 1

LocaleSettingsAppClass · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected