From d644f708c7c09b5dcddea44279519f3595a57801 Mon Sep 17 00:00:00 2001 From: The Dax Date: Wed, 12 Feb 2014 18:43:53 -0500 Subject: [PATCH 1/2] Allow the i18n ini path to be overridden with a custom path. --- i18n/i18n.cpp | 16 +++++++++++----- i18n/i18n.h | 2 +- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/i18n/i18n.cpp b/i18n/i18n.cpp index 6b93848b7a..702ed8f44f 100644 --- a/i18n/i18n.cpp +++ b/i18n/i18n.cpp @@ -72,14 +72,20 @@ bool I18NRepo::IniExists(const std::string &languageID) const { return true; } -bool I18NRepo::LoadIni(const std::string &languageID) { +bool I18NRepo::LoadIni(const std::string &languageID, const std::string &overridePath) { IniFile ini; - std::string iniPath = GetIniPath(languageID); -// ILOG("Loading lang ini %s", iniPath.c_str()); - if (!ini.LoadFromVFS(GetIniPath(languageID))) { - return false; + std::string iniPath; + + // ILOG("Loading lang ini %s", iniPath.c_str()); + if (!overridePath.empty()) { + iniPath = overridePath + languageID + ".ini"; + } else { + iniPath = GetIniPath(languageID); } + if (!ini.LoadFromVFS(iniPath)) + return false; + Clear(); const std::vector §ions = ini.Sections(); diff --git a/i18n/i18n.h b/i18n/i18n.h index b889a9c2d6..2a52b21043 100644 --- a/i18n/i18n.h +++ b/i18n/i18n.h @@ -66,7 +66,7 @@ public: ~I18NRepo(); bool IniExists(const std::string &languageID) const; - bool LoadIni(const std::string &languageID); // NOT the filename! + bool LoadIni(const std::string &languageID, const std::string &overridePath = ""); // NOT the filename! void SaveIni(const std::string &languageID); I18NCategory *GetCategory(const char *categoryName); From 128e95c079d91776d9daf573824c8539383114ac Mon Sep 17 00:00:00 2001 From: The Dax Date: Wed, 12 Feb 2014 18:48:09 -0500 Subject: [PATCH 2/2] Fix bad tab. --- i18n/i18n.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/i18n/i18n.cpp b/i18n/i18n.cpp index 702ed8f44f..84e7e79822 100644 --- a/i18n/i18n.cpp +++ b/i18n/i18n.cpp @@ -76,7 +76,7 @@ bool I18NRepo::LoadIni(const std::string &languageID, const std::string &overrid IniFile ini; std::string iniPath; - // ILOG("Loading lang ini %s", iniPath.c_str()); +// ILOG("Loading lang ini %s", iniPath.c_str()); if (!overridePath.empty()) { iniPath = overridePath + languageID + ".ini"; } else {