public static final String[] getKeywordValuesForLocale(String key, ULocale locale,
            boolean commonlyUsed) {
        // Resolve region
        String prefRegion = ULocale.getRegionForSupplementalData(locale, true);

        // Read preferred calendar values from supplementalData calendarPreferences
        ArrayList<String> values = new ArrayList<String>();

        UResourceBundle rb = UResourceBundle.getBundleInstance(
                ICUData.ICU_BASE_NAME,
                "supplementalData",
                ICUResourceBundle.ICU_DATA_CLASS_LOADER);
        UResourceBundle calPref = rb.get("calendarPreferenceData");
        UResourceBundle order = null;
        try {
            order = calPref.get(prefRegion);
        } catch (MissingResourceException mre) {
            // use "001" as fallback
            order = calPref.get("001");
        }

        String[] caltypes = order.getStringArray();
        if (commonlyUsed) {
            // we have all commonly used calendar for the target region
            return caltypes;
        }

        // if not commonlyUsed, add all preferred calendars in the order
        for (int i = 0; i < caltypes.length; i++) {
            values.add(caltypes[i]);
        }
        // then, add other available clanedars
        for (CalType t : CalType.values()) {
            if (!values.contains(t.id)) {
                values.add(t.id);
            }
        }
        return values.toArray(new String[values.size()]);
    }
public static final String [ ] getKeywordValuesForLocale ( String key , ULocale locale , boolean commonlyUsed ) { String prefRegion = ULocale . getRegionForSupplementalData ( locale , true ) ; ArrayList < String > values = new ArrayList < String > ( ) ; UResourceBundle rb = UResourceBundle . getBundleInstance ( ICUData . ICU_BASE_NAME , "supplementalData" , ICUResourceBundle . ICU_DATA_CLASS_LOADER ) ; UResourceBundle calPref = rb . get ( "calendarPreferenceData" ) ; UResourceBundle order = null ; try { order = calPref . get ( prefRegion ) ; } catch ( MissingResourceException mre ) { order = calPref . get ( "001" ) ; } String [ ] caltypes = order . getStringArray ( ) ; if ( commonlyUsed ) { return caltypes ; } for ( int i = 0 ; i < caltypes . length ; i ++ ) { values . add ( caltypes [ i ] ) ; } for ( CalType t : CalType . values ( ) ) { if ( ! values . contains ( t . id ) ) { values . add ( t . id ) ; } } return values . toArray ( new String [ values . size ( ) ] ) ; }
<strong>[icu]</strong> Given a key and a locale, returns an array of string values in a preferred
order that would make a difference. These are all and only those values where
the open (creation) of the service with the locale formed from the input locale
plus input keyword and that value has different behavior than creation with the
input locale alone.
@param key           one of the keys supported by this service.  For now, only
"calendar" is supported.
@param locale        the locale
@param commonlyUsed  if set to true it will return only commonly used values
with the given locale in preferred order.  Otherwise,
it will return all the available values for the locale.
@return an array of string values for the given key and the locale.