Java Code Examples for com.ibm.icu.impl.ICUResourceBundle#TABLE
The following examples show how to use
com.ibm.icu.impl.ICUResourceBundle#TABLE .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MeasureFormat.java From fitnotifications with Apache License 2.0 | 6 votes |
/** * Consume a table of per-unit tables. For example, * unitsShort/duration contains tables for duration-unit subtypes day & hour. */ void consumeSubtypeTable(UResource.Key key, UResource.Value value) { unit = MeasureUnit.internalGetInstance(type, key.toString()); // never null // Trigger a fresh lookup of the patterns for this unit+width. patterns = null; if (value.getType() == ICUResourceBundle.STRING) { // Units like "coordinate" that don't have plural variants setFormatterIfAbsent(StandardPlural.OTHER.ordinal(), value, 0); } else if (value.getType() == ICUResourceBundle.TABLE) { // Units that have plural variants UResource.Table patternTableTable = value.getTable(); for (int i = 0; patternTableTable.getKeyAndValue(i, key, value); i++) { consumePattern(key, value); } } else { throw new ICUException("Data for unit '" + unit + "' is in an unknown format"); } }
Example 2
Source File: RelativeDateTimeFormatter.java From fitnotifications with Apache License 2.0 | 5 votes |
public void consumeTimeUnit(UResource.Key key, UResource.Value value) { UResource.Table unitTypesTable = value.getTable(); for (int i = 0; unitTypesTable.getKeyAndValue(i, key, value); i++) { if (key.contentEquals("dn") && value.getType() == ICUResourceBundle.STRING) { handlePlainDirection(key, value); } if (value.getType() == ICUResourceBundle.TABLE) { if (key.contentEquals("relative")) { consumeTableRelative(key, value); } else if (key.contentEquals("relativeTime")) { consumeTableRelativeTime(key, value); } } } }
Example 3
Source File: DateIntervalInfo.java From fitnotifications with Apache License 2.0 | 5 votes |
@Override public void put(Key key, Value value, boolean noFallback) { // Iterate over all the calendar entries and only pick the 'intervalFormats' table. UResource.Table dateIntervalData = value.getTable(); for (int i = 0; dateIntervalData.getKeyAndValue(i, key, value); i++) { if (!key.contentEquals(INTERVAL_FORMATS_KEY)) { continue; } // Handle aliases and tables. Ignore the rest. if (value.getType() == ICUResourceBundle.ALIAS) { // Get the calendar type from the alias path. nextCalendarType = getCalendarTypeFromPath(value.getAliasString()); break; } else if (value.getType() == ICUResourceBundle.TABLE) { // Iterate over all the skeletons in the 'intervalFormat' table. UResource.Table skeletonData = value.getTable(); for (int j = 0; skeletonData.getKeyAndValue(j, key, value); j++) { if (value.getType() == ICUResourceBundle.TABLE) { // Process the skeleton processSkeletonTable(key, value); } } break; } } }