-updated so all languages can take default values from the default language

This commit is contained in:
Mark Vejvoda 2011-12-03 03:35:36 +00:00
parent 7b8c8195b0
commit 46d68b8d50
2 changed files with 12 additions and 1 deletions

View File

@ -262,9 +262,17 @@ bool Lang::isLanguageLocal(string compareLanguage) const {
return (compareLanguage == language);
}
string Lang::parseResult(const string &key, const string &value) {
if(value != "$USE_DEFAULT_LANGUAGE_VALUE") {
return value;
}
string result = Lang::get(key, DEFAULT_LANGUAGE);
return result;
}
string Lang::get(const string &s, string uselanguage, bool fallbackToDefault) {
try {
string result = "";
if(uselanguage != "") {
if(otherLanguageStrings.find(uselanguage) == otherLanguageStrings.end()) {
loadStrings(uselanguage, otherLanguageStrings[uselanguage], false);
@ -276,7 +284,8 @@ string Lang::get(const string &s, string uselanguage, bool fallbackToDefault) {
result = strings.getString(s);
replaceAll(result, "\\n", "\n");
}
return result;
return parseResult(s, result);;
}
catch(exception &ex) {
if(strings.getpath() != "") {

View File

@ -42,6 +42,8 @@ private:
bool fileMatchesISO630Code(string uselanguage, string testLanguageFile);
string getNativeLanguageName(string uselanguage, string testLanguageFile);
string parseResult(const string &key, const string &value);
public:
static Lang &getInstance();