#include "wx/hashset.h"
#include "wx/filesys.h"
-#if defined(__WXMAC__)
- #include "wx/mac/private.h" // includes mac headers
-#endif
-
#if defined(__DARWIN__)
#include "wx/mac/corefoundation/cfref.h"
#include <CoreFoundation/CFLocale.h>
bool wxPluralFormsScanner::nextToken()
{
wxPluralFormsToken::Type type = wxPluralFormsToken::T_ERROR;
- while (isspace(*m_s))
+ while (isspace((unsigned char) *m_s))
{
++m_s;
}
{
type = wxPluralFormsToken::T_EOF;
}
- else if (isdigit(*m_s))
+ else if (isdigit((unsigned char) *m_s))
{
wxPluralFormsToken::Number number = *m_s++ - '0';
- while (isdigit(*m_s))
+ while (isdigit((unsigned char) *m_s))
{
number = number * 10 + (*m_s++ - '0');
}
m_token.setNumber(number);
type = wxPluralFormsToken::T_NUMBER;
}
- else if (isalpha(*m_s))
+ else if (isalpha((unsigned char) *m_s))
{
const char* begin = m_s++;
- while (isalnum(*m_s))
+ while (isalnum((unsigned char) *m_s))
{
++m_s;
}
}
else // language supported by Windows
{
- const wxUint32 lcid = info->GetLCID();
-
// Windows CE doesn't have SetThreadLocale() and there doesn't seem
// to be any equivalent
#ifndef __WXWINCE__
+ const wxUint32 lcid = info->GetLCID();
+
// change locale used by Windows functions
::SetThreadLocale(lcid);
#endif
// for now we don't use the encoding, although we probably should (doing
// translations of the msg catalogs on the fly as required) (TODO)
//
- // we don't use the modifiers neither but we probably should translate
- // "euro" into iso885915
+ // we need the modified for languages like Valencian: ca_ES@valencia
+ // though, remember it
+ wxString modifier;
+ size_t posModifier = langFull.find_first_of(wxS("@"));
+ if ( posModifier != wxString::npos )
+ modifier = langFull.Mid(posModifier);
+
size_t posEndLang = langFull.find_first_of(wxS("@."));
if ( posEndLang != wxString::npos )
{
}
// 1. Try to find the language either as is:
- for ( i = 0; i < count; i++ )
+ // a) With modifier if set
+ if ( !modifier.empty() )
{
- if ( ms_languagesDB->Item(i).CanonicalName == langFull )
+ wxString langFullWithModifier = langFull + modifier;
+ for ( i = 0; i < count; i++ )
{
- break;
+ if ( ms_languagesDB->Item(i).CanonicalName == langFullWithModifier )
+ break;
+ }
+ }
+
+ // b) Without modifier
+ if ( modifier.empty() || i == count )
+ {
+ for ( i = 0; i < count; i++ )
+ {
+ if ( ms_languagesDB->Item(i).CanonicalName == langFull )
+ break;
}
}
return wxFONTENCODING_CP950;
}
#elif defined(__WXMAC__)
- TextEncoding encoding = 0 ;
+ CFStringEncoding encoding = 0 ;
encoding = CFStringGetSystemEncoding() ;
return wxMacGetFontEncFromSystemEnc( encoding ) ;
#elif defined(__UNIX_LIKE__) && wxUSE_FONTMAP
wxCFRef<CFLocaleRef> userLocaleRef(userLocaleRefRaw);
- CFTypeRef cfstr;
+ CFStringRef cfstr = 0;
switch ( index )
{
case wxLOCALE_THOUSANDS_SEP:
- cfstr = CFLocaleGetValue(userLocaleRef, kCFLocaleGroupingSeparator);
+ cfstr = (CFStringRef) CFLocaleGetValue(userLocaleRef, kCFLocaleGroupingSeparator);
break;
case wxLOCALE_DECIMAL_POINT:
- cfstr = CFLocaleGetValue(userLocaleRef, kCFLocaleDecimalSeparator);
+ cfstr = (CFStringRef) CFLocaleGetValue(userLocaleRef, kCFLocaleDecimalSeparator);
break;
default:
wxFAIL_MSG( "Unknown locale info" );
+ cfstr = CFSTR("");
+ break;
}
- wxCFStringRef
- str(CFStringCreateCopy(NULL, static_cast<CFStringRef>(cfstr)));
+ wxCFStringRef str(wxCFRetain(cfstr));
return str.AsString();
}
#ifndef LANG_UZBEK
#define LANG_UZBEK (0)
#endif
-#ifndef LANG_VALENCIAN
-#define LANG_VALENCIAN (0)
-#endif
#ifndef LANG_VIETNAMESE
#define LANG_VIETNAMESE (0)
#endif
LNG(wxLANGUAGE_UZBEK, "uz" , LANG_UZBEK , SUBLANG_DEFAULT , wxLayout_LeftToRight, "Uzbek")
LNG(wxLANGUAGE_UZBEK_CYRILLIC, "uz" , LANG_UZBEK , SUBLANG_UZBEK_CYRILLIC , wxLayout_LeftToRight, "Uzbek (Cyrillic)")
LNG(wxLANGUAGE_UZBEK_LATIN, "uz" , LANG_UZBEK , SUBLANG_UZBEK_LATIN , wxLayout_LeftToRight, "Uzbek (Latin)")
- LNG(wxLANGUAGE_VALENCIAN, "ca_ES@valencia", LANG_VALENCIAN , SUBLANG_DEFAULT , wxLayout_LeftToRight, "Valencian")
+ LNG(wxLANGUAGE_VALENCIAN, "ca_ES@valencia", 0 , 0 , wxLayout_LeftToRight, "Valencian")
LNG(wxLANGUAGE_VIETNAMESE, "vi_VN", LANG_VIETNAMESE, SUBLANG_DEFAULT , wxLayout_LeftToRight, "Vietnamese")
LNG(wxLANGUAGE_VOLAPUK, "vo" , 0 , 0 , wxLayout_LeftToRight, "Volapuk")
LNG(wxLANGUAGE_WELSH, "cy" , 0 , 0 , wxLayout_LeftToRight, "Welsh")