// using patterns of plural count "other",
// then, "other" is the searchPluralCount.
private void searchInTree(String resourceKey, int styl,
TimeUnit timeUnit, String srcPluralCount,
String searchPluralCount, Map countToPatterns) {
ULocale parentLocale=locale;
String srcTimeUnitName = timeUnit.toString();
while ( parentLocale != null ) {
try {
// look for pattern for srcPluralCount in locale tree
ICUResourceBundle unitsRes = (ICUResourceBundle) UResourceBundle.getBundleInstance(ICUResourceBundle.ICU_BASE_NAME, parentLocale);
unitsRes = unitsRes.getWithFallback(resourceKey);
ICUResourceBundle oneUnitRes = unitsRes.getWithFallback(srcTimeUnitName);
String pattern = oneUnitRes.getStringWithFallback(searchPluralCount);
final MessageFormat messageFormat = new MessageFormat(pattern, locale);
if (format != null) {
messageFormat.setFormatByArgumentIndex(0, format);
}
Object[] pair = (Object[])countToPatterns.get(srcPluralCount);
if (pair == null) {
pair = new Object[2];
countToPatterns.put(srcPluralCount, pair);
}
pair[styl] = messageFormat;
return;
} catch ( MissingResourceException e ) {
}
parentLocale=parentLocale.getFallback();
}
// if not found the pattern for this plural count at all,
// fall-back to plural count "other"
if ( searchPluralCount.equals("other") ) {
// set default fall back the same as the resource in root