private static String[] lookupBundle( ResourceBundle rb, int len, String elementName, TextWidth tw, OutputContext oc, int baseIndex) { String[] names = new String[len]; boolean shortKey = (elementName.length() == 1); for (int i = 0; i < len; i++) { StringBuilder b = new StringBuilder(); b.append(elementName); b.append('('); if (shortKey) { char c = tw.name().charAt(0); if (oc != OutputContext.STANDALONE) { c = Character.toLowerCase(c); } b.append(c); } else { b.append(tw.name()); if (oc == OutputContext.STANDALONE) { b.append('|'); b.append(oc.name()); } } b.append(')'); b.append('_'); b.append(i + baseIndex); String key = b.toString(); if (rb.containsKey(key)) { names[i] = rb.getString(key); } else { return null; } } return names; }
private static String meridiemKey(String meridiem, TextWidth tw, OutputContext oc) { char c = tw.name().charAt(0); if (oc == OutputContext.FORMAT) { c = Character.toLowerCase(c); } return "P(" + String.valueOf(c) + ")_" + meridiem; }
private static String getEnglishPattern( String wide, String abbr, String narrow, TextWidth width, PluralCategory category) { switch (width) { case WIDE: return getPluralPattern(wide, category); case ABBREVIATED: case SHORT: return getPluralPattern(abbr, category); case NARROW: return "{0}" + narrow; default: throw new UnsupportedOperationException(width.name()); } }