patcher.diff
b/code/ryzom/tools/client/client_patcher/main.cpp Mon Mar 14 12:09:03 2011 +0100 | ||
---|---|---|
183 | 183 |
// check if console supports utf-8 |
184 | 184 |
std::string lang = toLower(std::string(setlocale(LC_CTYPE, ""))); |
185 | 185 |
useUtf8 = (lang.find("utf8") != string::npos || lang.find("utf-8") != string::npos); |
186 |
lang = lang.substr(0, 2); |
|
186 |
// get language code (often it comes with country code too) |
|
187 |
lang = lang.substr(0, lang.find('.')); |
|
188 |
std::string country = ""; |
|
189 |
if (lang.find('_') != string::npos) |
|
190 |
{ |
|
191 |
country = lang.substr(lang.find('_') + 1); |
|
192 |
lang = lang.substr(0, lang.find('_')); |
|
193 |
} |
|
187 | 194 |
|
188 | 195 |
// check if console supports colors |
189 | 196 |
std::string term = toLower(std::string(getenv("TERM") ? getenv("TERM"):"")); |
... | ... | |
263 | 270 |
#ifdef RYZOM_SHARE_PREFIX |
264 | 271 |
CPath::addSearchPath(RYZOM_SHARE_PREFIX"/patcher", true, false); |
265 | 272 |
#endif |
273 |
// first try find translation with country code (if we have country code) |
|
274 |
if ((!country.empty()) && (CPath::exists(lang + "_" + country + ".uxt"))) |
|
275 |
{ |
|
276 |
lang = lang + "_" + country + ".uxt"; |
|
277 |
} |
|
278 |
// if translation file still not found, use English translation as a default |
|
279 |
if (!CPath::exists(lang + ".uxt")) |
|
280 |
{ |
|
281 |
lang = "en"; |
|
282 |
} |
|
266 | 283 |
} |
267 | 284 |
|
268 | 285 |
// load translation |