Use PascalCase for lang helpers and constexpr names.
This commit is contained in:
@@ -27,8 +27,8 @@
|
|||||||
namespace lang {
|
namespace lang {
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
constexpr const char *kUltrahandConfigPath = "sdmc:/config/ultrahand/config.ini";
|
constexpr const char *UltrahandConfigPath = "sdmc:/config/ultrahand/config.ini";
|
||||||
constexpr const char *kLangDir = "sdmc:" FILE_CONFIG_DIR "/lang/";
|
constexpr const char *LangDir = "sdmc:" FILE_CONFIG_DIR "/lang/";
|
||||||
|
|
||||||
std::string gLoadedLang;
|
std::string gLoadedLang;
|
||||||
std::unordered_map<std::string, std::string> gCache;
|
std::unordered_map<std::string, std::string> gCache;
|
||||||
@@ -89,7 +89,7 @@ namespace lang {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool LoadLangFile(const std::string &langCode) {
|
bool LoadLangFile(const std::string &langCode) {
|
||||||
const std::string path = std::string(kLangDir) + langCode + ".json";
|
const std::string path = std::string(LangDir) + langCode + ".json";
|
||||||
std::string content;
|
std::string content;
|
||||||
if (!ReadFileContent(path, content)) {
|
if (!ReadFileContent(path, content)) {
|
||||||
return false;
|
return false;
|
||||||
@@ -103,7 +103,7 @@ namespace lang {
|
|||||||
|
|
||||||
std::string GetDefaultLang() {
|
std::string GetDefaultLang() {
|
||||||
char buf[32] = {};
|
char buf[32] = {};
|
||||||
ini_gets("ultrahand", "default_lang", "en", buf, sizeof(buf), kUltrahandConfigPath);
|
ini_gets("ultrahand", "default_lang", "en", buf, sizeof(buf), UltrahandConfigPath);
|
||||||
if (buf[0] == '\0') {
|
if (buf[0] == '\0') {
|
||||||
return "en";
|
return "en";
|
||||||
}
|
}
|
||||||
@@ -123,7 +123,7 @@ namespace lang {
|
|||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
std::string translate(const std::string &text) {
|
std::string Translate(const std::string &text) {
|
||||||
if (text.empty()) {
|
if (text.empty()) {
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,6 @@ namespace lang {
|
|||||||
// Translates text using Ultrahand's language setting and
|
// Translates text using Ultrahand's language setting and
|
||||||
// /config/horizon-oc/lang/<lang>.json (same format as the overlay).
|
// /config/horizon-oc/lang/<lang>.json (same format as the overlay).
|
||||||
// Returns the original text when no translation is available.
|
// Returns the original text when no translation is available.
|
||||||
std::string translate(const std::string &text);
|
std::string Translate(const std::string &text);
|
||||||
|
|
||||||
} // namespace lang
|
} // namespace lang
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ namespace notification {
|
|||||||
}
|
}
|
||||||
fclose(flagFile);
|
fclose(flagFile);
|
||||||
|
|
||||||
const std::string translated = lang::translate(message);
|
const std::string translated = lang::Translate(message);
|
||||||
|
|
||||||
std::string filename = "hoc-" + std::to_string(std::time(nullptr)) + ".notify";
|
std::string filename = "hoc-" + std::to_string(std::time(nullptr)) + ".notify";
|
||||||
std::string fullPath = "sdmc:/config/ultrahand/notifications/" + filename;
|
std::string fullPath = "sdmc:/config/ultrahand/notifications/" + filename;
|
||||||
|
|||||||
Reference in New Issue
Block a user