Core: Fixed problem in LanguageInfo

git-svn-id: svn://ultimatepp.org/upp/trunk@1812 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2009-12-15 06:43:20 +00:00
parent 4697e56e58
commit f4a72cf31b
3 changed files with 14 additions and 4 deletions

View file

@ -16,8 +16,7 @@ int SetLNGCharset(int lng, byte chrset);
#define LNG_CZECH 0xF1CC7A // Deprecated, corresponds to CS-CZ windows-1250
#define LNG_ENGLISH 0x2BAB3 // LNG_('E', 'N', 'U', 'S')
#define LNG_CURRENT -1
#define LNG_MASTER -2
#define LNG_CURRENT 0
void SetLanguage(int lang);
int GetCurrentLanguage();
@ -30,7 +29,6 @@ const int *GetAllLanguages();
String GetLangName(int language);
String GetNativeLangName(int language);
//byte GetLangCharset(int language);
String txtGet(const char *id, int language = LNG_CURRENT);
@ -79,6 +77,8 @@ public:
bool operator()(String a, String b) const { return Compare(a, b) < 0; }
String ToString() const;
LanguageInfo();
//BWC
WString month_names[12], short_month_names[12];

View file

@ -268,6 +268,12 @@ LCID GetLanguageLCID(int language)
}
#endif
LanguageInfo::LanguageInfo()
{
getindexletter = DefaultGetIndexLetter;
compare = DefaultLanguageCompare;
}
void LanguageInfo::Set(int lang_)
{
language = lang_;
@ -496,6 +502,8 @@ StaticMutex sLanguageInfoMutex;
const LanguageInfo& GetLanguageInfo(int lang)
{
Mutex::Lock __(sLanguageInfoMutex);
if(!lang)
lang = GetCurrentLanguage();
ArrayMap<int, LanguageInfo>& m = LangMap();
int q = m.Find(lang);
if(q >= 0)
@ -513,6 +521,8 @@ const LanguageInfo& GetLanguageInfo()
void SetLanguageInfo(int lang, const LanguageInfo& lf)
{
Mutex::Lock __(sLanguageInfoMutex);
if(!lang)
lang = GetCurrentLanguage();
ArrayMap<int, LanguageInfo>& m = LangMap();
m.GetAdd(lang) = lf;
}

View file

@ -616,7 +616,7 @@ int StdValueCompare(const Value& a, const Value& b, int language)
int StdValueCompare(const Value& a, const Value& b)
{
return StdValueCompare(a, b, 0);
return StdValueCompare(a, b, GetCurrentLanguage());
}
int StdValueCompareDesc(const Value& a, const Value& b, int language)