static const size_t LEN_SUBLANG = 2;
static const size_t LEN_FULL = LEN_LANG + 1 + LEN_SUBLANG; // 1 for '_'
static const size_t LEN_SUBLANG = 2;
static const size_t LEN_FULL = LEN_LANG + 1 + LEN_SUBLANG; // 1 for '_'
searchPath << GetFullSearchPath(fullname) << wxPATH_SEP;
}
#endif // wxUSE_FONTMAP
searchPath += GetFullSearchPath(szDirPrefix);
searchPath << GetFullSearchPath(fullname) << wxPATH_SEP;
}
#endif // wxUSE_FONTMAP
searchPath += GetFullSearchPath(szDirPrefix);
if ( sublocaleIndex != wxString::npos )
{
// also add just base locale name: for things like "fr_BE" (belgium
if ( sublocaleIndex != wxString::npos )
{
// also add just base locale name: for things like "fr_BE" (belgium
NoTransErr noTransErr;
wxLogVerbose(_("looking for catalog '%s' in path '%s'."),
szName, searchPath.c_str());
NoTransErr noTransErr;
wxLogVerbose(_("looking for catalog '%s' in path '%s'."),
szName, searchPath.c_str());
#endif // wxUSE_FILESYSTEM/!wxUSE_FILESYSTEM
{
wxLogVerbose(_("catalog file for domain '%s' not found."), szName);
#endif // wxUSE_FILESYSTEM/!wxUSE_FILESYSTEM
{
wxLogVerbose(_("catalog file for domain '%s' not found."), szName);
return false;
}
// open file and read its data
wxLogVerbose(_("using catalog '%s' from '%s'."), szName, strFullName.c_str());
return false;
}
// open file and read its data
wxLogVerbose(_("using catalog '%s' from '%s'."), szName, strFullName.c_str());
// read the whole file in memory
if ( fileMsg.Read(m_data.GetWriteBuf(nSize), nSize) != lenFile )
// read the whole file in memory
if ( fileMsg.Read(m_data.GetWriteBuf(nSize), nSize) != lenFile )
// there may be a catalog with toolkit specific overrides, it is not
// an error if this does not exist
// there may be a catalog with toolkit specific overrides, it is not
// an error if this does not exist
// Some C libraries (namely glibc) still use old ISO 639,
// so will translate the abbrev for them
wxString localeAlt;
// Some C libraries (namely glibc) still use old ISO 639,
// so will translate the abbrev for them
wxString localeAlt;
- if ( langOnly == wxT("he") )
- localeAlt = wxT("iw") + locale.Mid(3);
- else if ( langOnly == wxT("id") )
- localeAlt = wxT("in") + locale.Mid(3);
- else if ( langOnly == wxT("yi") )
- localeAlt = wxT("ji") + locale.Mid(3);
- else if ( langOnly == wxT("nb") )
- localeAlt = wxT("no_NO");
- else if ( langOnly == wxT("nn") )
- localeAlt = wxT("no_NY");
+ if ( langOnly == wxS("he") )
+ localeAlt = wxS("iw") + locale.Mid(3);
+ else if ( langOnly == wxS("id") )
+ localeAlt = wxS("in") + locale.Mid(3);
+ else if ( langOnly == wxS("yi") )
+ localeAlt = wxS("ji") + locale.Mid(3);
+ else if ( langOnly == wxS("nb") )
+ localeAlt = wxS("no_NO");
+ else if ( langOnly == wxS("nn") )
+ localeAlt = wxS("no_NY");
// because SetThreadLocale does not modify change the
// interpretation of setlocale(LC_ALL, "") call:
wxChar buffer[256];
// because SetThreadLocale does not modify change the
// interpretation of setlocale(LC_ALL, "") call:
wxChar buffer[256];
GetLocaleInfo(lcid, LOCALE_SENGLANGUAGE, buffer, 256);
locale << buffer;
if (GetLocaleInfo(lcid, LOCALE_SENGCOUNTRY, buffer, 256) > 0)
GetLocaleInfo(lcid, LOCALE_SENGLANGUAGE, buffer, 256);
locale << buffer;
if (GetLocaleInfo(lcid, LOCALE_SENGCOUNTRY, buffer, 256) > 0)
if (GetLocaleInfo(lcid, LOCALE_IDEFAULTANSICODEPAGE, buffer, 256) > 0)
{
codepage = wxAtoi(buffer);
if (codepage != 0)
if (GetLocaleInfo(lcid, LOCALE_IDEFAULTANSICODEPAGE, buffer, 256) > 0)
{
codepage = wxAtoi(buffer);
if (codepage != 0)
wxChar buffer[16];
if (GetLocaleInfo(LOCALE_USER_DEFAULT,
LOCALE_IDEFAULTANSICODEPAGE, buffer, 16) > 0 &&
wxChar buffer[16];
if (GetLocaleInfo(LOCALE_USER_DEFAULT,
LOCALE_IDEFAULTANSICODEPAGE, buffer, 16) > 0 &&
wxCFRef<CFLocaleRef> userLocaleRef(CFLocaleCopyCurrent());
// because the locale identifier (kCFLocaleIdentifier) is formatted a little bit differently, eg
// az_Cyrl_AZ@calendar=buddhist;currency=JPY we just recreate the base info as expected by wx here
wxCFRef<CFLocaleRef> userLocaleRef(CFLocaleCopyCurrent());
// because the locale identifier (kCFLocaleIdentifier) is formatted a little bit differently, eg
// az_Cyrl_AZ@calendar=buddhist;currency=JPY we just recreate the base info as expected by wx here
- CFTypeRef cfstr = CFLocaleGetValue(userLocaleRef, kCFLocaleLanguageCode);
- wxMacCFStringHolder str(CFStringCreateCopy(NULL, static_cast<CFStringRef>(cfstr)));
+ wxCFStringRef str(wxCFRetain((CFStringRef)CFLocaleGetValue(userLocaleRef, kCFLocaleLanguageCode)));
-
- cfstr = CFLocaleGetValue(userLocaleRef, kCFLocaleCountryCode);
- str.Assign(CFStringCreateCopy(NULL, static_cast<CFStringRef>(cfstr)));
+ str.reset(wxCFRetain((CFStringRef)CFLocaleGetValue(userLocaleRef, kCFLocaleCountryCode)));
- if (!wxGetEnv(wxT("LC_ALL"), &langFull) &&
- !wxGetEnv(wxT("LC_MESSAGES"), &langFull) &&
- !wxGetEnv(wxT("LANG"), &langFull))
+ if (!wxGetEnv(wxS("LC_ALL"), &langFull) &&
+ !wxGetEnv(wxS("LC_MESSAGES"), &langFull) &&
+ !wxGetEnv(wxS("LANG"), &langFull))
{
// no language specified, treat it as English
return wxLANGUAGE_ENGLISH_US;
}
{
// no language specified, treat it as English
return wxLANGUAGE_ENGLISH_US;
}
{
// 0. Make sure the lang is according to latest ISO 639
// (this is necessary because glibc uses iw and in instead
{
// 0. Make sure the lang is according to latest ISO 639
// (this is necessary because glibc uses iw and in instead
- if ( langOrig == wxT("iw"))
- lang = _T("he");
- else if (langOrig == wxT("in"))
- lang = wxT("id");
- else if (langOrig == wxT("ji"))
- lang = wxT("yi");
- else if (langOrig == wxT("no_NO"))
- lang = wxT("nb_NO");
- else if (langOrig == wxT("no_NY"))
- lang = wxT("nn_NO");
- else if (langOrig == wxT("no"))
- lang = wxT("nb_NO");
+ if ( langOrig == wxS("iw"))
+ lang = wxS("he");
+ else if (langOrig == wxS("in"))
+ lang = wxS("id");
+ else if (langOrig == wxS("ji"))
+ lang = wxS("yi");
+ else if (langOrig == wxS("no_NO"))
+ lang = wxS("nb_NO");
+ else if (langOrig == wxS("no_NY"))
+ lang = wxS("nn_NO");
+ else if (langOrig == wxS("no"))
+ lang = wxS("nb_NO");
#if defined(__WIN32__) && !defined(__WXMICROWIN__)
// FIXME: what is the error return value for GetACP()?
UINT codepage = ::GetACP();
#if defined(__WIN32__) && !defined(__WXMICROWIN__)
// FIXME: what is the error return value for GetACP()?
UINT codepage = ::GetACP();
switch (index)
{
case wxLOCALE_DECIMAL_POINT:
count = ::GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SDECIMAL, buffer, 256);
if (!count)
switch (index)
{
case wxLOCALE_DECIMAL_POINT:
count = ::GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SDECIMAL, buffer, 256);
if (!count)
case wxSYS_LIST_SEPARATOR:
count = ::GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SLIST, buffer, 256);
if (!count)
case wxSYS_LIST_SEPARATOR:
count = ::GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SLIST, buffer, 256);
if (!count)
else
str << buffer;
break;
case wxSYS_LEADING_ZERO: // 0 means no leading zero, 1 means leading zero
count = ::GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_ILZERO, buffer, 256);
if (!count)
else
str << buffer;
break;
case wxSYS_LEADING_ZERO: // 0 means no leading zero, 1 means leading zero
count = ::GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_ILZERO, buffer, 256);
if (!count)
#define LNG(wxlang, canonical, winlang, winsublang, layout, desc) \
info.Language = wxlang; \
#define LNG(wxlang, canonical, winlang, winsublang, layout, desc) \
info.Language = wxlang; \