// " bundle: " + bundle.getULocale());
try {
for (;;) {
// special case currency
if ("currency".equals(subtableName)) {
ICUResourceBundle table = bundle.getWithFallback("Currencies");
table = table.getWithFallback(item);
return table.getString(1);
} else {
ICUResourceBundle table = bundle.getWithFallback(tableName);
try {
if (subtableName != null) {
table = table.getWithFallback(subtableName);
}
return table.getStringWithFallback(item);
}
catch (MissingResourceException e) {
if(subtableName==null){
try{
// may be a deprecated code
String currentName = null;
if(tableName.equals("Countries")){
currentName = getCurrentCountryID(item);
}else if(tableName.equals("Languages")){
currentName = getCurrentLanguageID(item);
}
return table.getStringWithFallback(currentName);
}catch (MissingResourceException ex){/* fall through*/}
}
// still can't figure out ?.. try the fallback mechanism
String fallbackLocale = table.getWithFallback("Fallback").getString();
if (fallbackLocale.length() == 0) {
fallbackLocale = "root";
}
// System.out.println("bundle: " + bundle.getULocale() + " fallback: " + fallbackLocale);
if(fallbackLocale.equals(table.getULocale().localeID)){
return item;
}
bundle = (ICUResourceBundle)UResourceBundle.getBundleInstance(ICUResourceBundle.ICU_BASE_NAME,
fallbackLocale);
// System.out.println("fallback from " + table.getULocale() + " to " + fallbackLocale +