1
0
Fork 0
mirror of https://github.com/AquariaOSE/Aquaria.git synced 2025-07-06 16:04:41 +00:00

Fix locale related oversights

This commit is contained in:
fgenesis 2012-07-11 04:50:19 +02:00
parent 459a41e1f6
commit 345ff6063b
3 changed files with 61 additions and 64 deletions

View file

@ -49,14 +49,12 @@ void UserSettings::save()
} }
xml_system.InsertEndChild(xml_debugLog); xml_system.InsertEndChild(xml_debugLog);
if (!system.isSystemLocale) {
TiXmlElement xml_locale("Locale"); TiXmlElement xml_locale("Locale");
{ {
xml_locale.SetAttribute("name", system.locale); xml_locale.SetAttribute("name", system.locale);
} }
xml_system.InsertEndChild(xml_locale); xml_system.InsertEndChild(xml_locale);
} }
}
doc.InsertEndChild(xml_system); doc.InsertEndChild(xml_system);
TiXmlElement xml_audio("Audio"); TiXmlElement xml_audio("Audio");

View file

@ -77,9 +77,8 @@ class UserSettings
public: public:
struct System struct System
{ {
System() { debugLogOn = 0; isSystemLocale = false; } System() { debugLogOn = 0; }
int debugLogOn; int debugLogOn;
bool isSystemLocale;
std::string locale; std::string locale;
} system; } system;

View file

@ -20,7 +20,7 @@
static std::string _CFToStdString(CFStringRef cs) static std::string _CFToStdString(CFStringRef cs)
{ {
char buf[1024]; char buf[1024];
CFStringGetCString(cs, &buf[0], 2048, kCFStringEncodingUTF8); CFStringGetCString(cs, &buf[0], 1024, kCFStringEncodingUTF8);
return &buf[0]; return &buf[0];
} }
#endif #endif
@ -93,8 +93,8 @@ std::string getSystemLocale()
if ((buf = (CFStringRef)CFLocaleGetValue(locale, kCFLocaleCountryCode)) != NULL) if ((buf = (CFStringRef)CFLocaleGetValue(locale, kCFLocaleCountryCode)) != NULL)
{ {
system.locale += "_"; localeStr += "_";
system.locale += _CFToStdString(buf); localeStr += _CFToStdString(buf);
CFRelease(buf); CFRelease(buf);
} }
} }
@ -108,7 +108,7 @@ std::string getSystemLocale()
{ {
localeStr = lang; localeStr = lang;
size_t found = system.locale.find('.'); size_t found = localeStr.find('.');
if (found != string::npos) if (found != string::npos)
localeStr.resize(found); localeStr.resize(found);