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

Function getI18nDataFilePath

Tactility/Source/i18n/TextResources.cpp:36–53  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

34}
35
36static std::string getI18nDataFilePath(const std::string& path) {
37 auto locale = getDesiredLocale();
38 auto desired_file_path = std::format("{}/{}.i18n", path, locale);
39 if (file::isFile(desired_file_path)) {
40 return desired_file_path;
41 } else {
42 LOGGER.warn("Translations not found for {} at {}", locale, desired_file_path);
43 }
44
45 auto fallback_locale = getFallbackLocale();
46 auto fallback_file_path = std::format("{}/{}.i18n", path, getFallbackLocale());
47 if (file::isFile(fallback_file_path)) {
48 return fallback_file_path;
49 } else {
50 LOGGER.warn("Fallback translations not found for {} at {}", fallback_locale, fallback_file_path);
51 return "";
52 }
53}
54
55std::string TextResources::ERROR_RESULT = "TXT_RES_ERROR";
56

Callers 1

loadMethod · 0.85

Calls 4

getDesiredLocaleFunction · 0.85
isFileFunction · 0.85
getFallbackLocaleFunction · 0.85
warnMethod · 0.80

Tested by

no test coverage detected