public CLDR.Locale match(MetaLocale locale) {
    MetaLocale result = availableBundlesMap.get(locale);
    MetaLocale maxBundleId = null;
    if (result == null) {
      // If the locale isn't expanded, do that here by adding likely subtags.
      // For the vast majority of cases this code shouldn't be executed, since
      // we've indexed permutations of locales to create a static mapping to
      // bundle identifiers.
      maxBundleId = languageResolver.addLikelySubtags(locale);
      MetaLocale minBundleId = languageResolver.removeLikelySubtags(maxBundleId);
      result = availableBundlesMap.get(minBundleId);
    }
    if (result == null) {
      // Fallback necessary to find best match for language tags that have
      // invalid fields, e.g. those with an unknown region, etc.
      MetaLocale key = maxBundleId.copy();
      for (int flags : LanguageResolver.MATCH_ORDER) {
        LanguageResolver.set(maxBundleId, key, flags);
        result = availableBundlesMap.get(key);
        if (result != null && result.hasLanguage()) {
          return result;
        }
      }
    }
    return result != null ? result : availableBundlesMap.get((MetaLocale)CLDR.Locale.en);
  }
public CLDR . Locale match ( MetaLocale locale ) { MetaLocale result = availableBundlesMap . get ( locale ) ; MetaLocale maxBundleId = null ; if ( result == null ) { maxBundleId = languageResolver . addLikelySubtags ( locale ) ; MetaLocale minBundleId = languageResolver . removeLikelySubtags ( maxBundleId ) ; result = availableBundlesMap . get ( minBundleId ) ; } if ( result == null ) { MetaLocale key = maxBundleId . copy ( ) ; for ( int flags : LanguageResolver . MATCH_ORDER ) { LanguageResolver . set ( maxBundleId , key , flags ) ; result = availableBundlesMap . get ( key ) ; if ( result != null && result . hasLanguage ( ) ) { return result ; } } } return result != null ? result : availableBundlesMap . get ( ( MetaLocale ) CLDR . Locale . en ) ; }
Given a MetaLocale object (internal to CLDR), return the best available
CLDR bundle identifier.