/** * Returns the measurement system used in the locale specified by the locale. * * @param locale The locale for which the measurement system to be retrieved. * @return MeasurementSystem the measurement system used in the locale. * @stable ICU 3.0 */ public static final MeasurementSystem getMeasurementSystem(ULocale locale){ UResourceBundle sysBundle = measurementTypeBundleForLocale(locale, MEASUREMENT_SYSTEM); switch (sysBundle.getInt()) { case 0: return MeasurementSystem.SI; case 1: return MeasurementSystem.US; case 2: return MeasurementSystem.UK; default: // return null if the object is null or is not an instance // of integer indicating an error return null; } }
/** * Returns the size of paper used in the locale. The paper sizes returned are always in * <em>milli-meters</em>. * @param locale The locale for which the measurement system to be retrieved. * @return The paper size used in the locale * @stable ICU 3.0 */ public static final PaperSize getPaperSize(ULocale locale){ UResourceBundle obj = measurementTypeBundleForLocale(locale, PAPER_SIZE); int[] size = obj.getIntVector(); return new PaperSize(size[0], size[1]); }