Ticket #2533: lng_verification.diff

File lng_verification.diff, 1.1 KB (added by sanderd17, 10 years ago)
  • source/i18n/L10n.cpp

     
    9797    return ValidateLocale(Locale::createCanonical(localeCode.c_str()));
    9898}
    9999
    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.
    103101bool L10n::ValidateLocale(Locale locale)
    104102{
    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    
    119103    for (std::vector<Locale*>::iterator iterator = availableLocales.begin(); iterator != availableLocales.end(); ++iterator)
    120104    {
    121105        if ((strcmp((*iterator)->getLanguage(), locale.getLanguage()) == 0 && strcmp((*iterator)->getCountry(), "") == 0) ||