Ticket #2533: lng_verification.diff
File lng_verification.diff, 1.1 KB (added by , 10 years ago) |
---|
-
source/i18n/L10n.cpp
97 97 return ValidateLocale(Locale::createCanonical(localeCode.c_str())); 98 98 } 99 99 100 // Returns true if both of these conditions are true: 101 // 1. ICU has resources for that locale (which also ensures it's a valid locale string) 102 // 2. Either a dictionary for language_country or for language is available. 100 // Returns true if either a dictionary for language_country or for language is available. 103 101 bool L10n::ValidateLocale(Locale locale) 104 102 { 105 int32_t count;106 bool icuSupported = false;107 const Locale* icuSupportedLocales = Locale::getAvailableLocales(count);108 for (int i=0; i<count; ++i)109 {110 if (icuSupportedLocales[i] == locale)111 {112 icuSupported = true;113 break;114 }115 }116 if(!icuSupported)117 return false;118 119 103 for (std::vector<Locale*>::iterator iterator = availableLocales.begin(); iterator != availableLocales.end(); ++iterator) 120 104 { 121 105 if ((strcmp((*iterator)->getLanguage(), locale.getLanguage()) == 0 && strcmp((*iterator)->getCountry(), "") == 0) ||