Java Code Examples for java.text.NumberFormat#getAvailableLocales()

The following examples show how to use java.text.NumberFormat#getAvailableLocales() . 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: DataType.java    From arx with Apache License 2.0 5 votes vote down vote up
/**
 * Provides a list of example formats for the <code>Decimal</code> data type.
 *
 * @return
 */
private static List<String> listDecimalFormats(){
    List<String> result = new ArrayList<String>();
    result.add("0.###");
    result.add("0.00");
    result.add("#,##0.###");
    result.add("#,##0.00");
    result.add("#,##0");
    result.add("#,##0%");
    
    // Create list of common patterns
    Set<String> set = new HashSet<String>();
    set.addAll(result);
    for (Locale locale: NumberFormat.getAvailableLocales()) {
        for (NumberFormat format : new NumberFormat[] { NumberFormat.getNumberInstance(locale),
                                                        NumberFormat.getIntegerInstance(locale),
                                                        NumberFormat.getCurrencyInstance(locale),
                                                        NumberFormat.getPercentInstance(locale) }) {

            // Add pattern
            if (format instanceof DecimalFormat) {
                String pattern = ((DecimalFormat)format).toPattern();
                if (!set.contains(pattern)) {
                    set.add(pattern);
                    result.add(pattern);
                }
            }
        }
        
    }
    return result;
}
 
Example 2
Source File: ExtendedMessageFormatTest.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Test the built in number formats.
 */
@Test
public void testBuiltInNumberFormat() {
    final Object[] args = new Object[] {Double.valueOf("6543.21")};
    final Locale[] availableLocales = NumberFormat.getAvailableLocales();
    checkBuiltInFormat("1: {0,number}",            args, availableLocales);
    checkBuiltInFormat("2: {0,number,integer}",    args, availableLocales);
    checkBuiltInFormat("3: {0,number,currency}",   args, availableLocales);
    checkBuiltInFormat("4: {0,number,percent}",    args, availableLocales);
    checkBuiltInFormat("5: {0,number,00000.000}",  args, availableLocales);
}
 
Example 3
Source File: FractionFormat.java    From astor with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Get the set of locales for which complex formats are available.  This
 * is the same set as the {@link NumberFormat} set.
 * @return available complex format locales.
 */
public static Locale[] getAvailableLocales() {
    return NumberFormat.getAvailableLocales();
}
 
Example 4
Source File: ComplexFormat.java    From astor with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Get the set of locales for which complex formats are available.
 * <p>This is the same set as the {@link NumberFormat} set.</p>
 * @return available complex format locales.
 */
public static Locale[] getAvailableLocales() {
    return NumberFormat.getAvailableLocales();
}
 
Example 5
Source File: VectorFormat.java    From astor with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Get the set of locales for which point/vector formats are available.
 * <p>This is the same set as the {@link NumberFormat} set.</p>
 * @return available point/vector format locales.
 */
public static Locale[] getAvailableLocales() {
    return NumberFormat.getAvailableLocales();
}
 
Example 6
Source File: RealVectorFormat.java    From astor with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Get the set of locales for which real vectors formats are available.
 * <p>This is the same set as the {@link NumberFormat} set.</p>
 * @return available real vector format locales.
 */
public static Locale[] getAvailableLocales() {
    return NumberFormat.getAvailableLocales();
}
 
Example 7
Source File: VectorFormat.java    From astor with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Get the set of locales for which point/vector formats are available.
 * <p>This is the same set as the {@link NumberFormat} set.</p>
 * @return available point/vector format locales.
 */
public static Locale[] getAvailableLocales() {
    return NumberFormat.getAvailableLocales();
}
 
Example 8
Source File: RealVectorFormat.java    From astor with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Get the set of locales for which real vectors formats are available.
 * <p>This is the same set as the {@link NumberFormat} set.</p>
 * @return available real vector format locales.
 */
public static Locale[] getAvailableLocales() {
    return NumberFormat.getAvailableLocales();
}
 
Example 9
Source File: Cardumen_0032_t.java    From coming with MIT License 2 votes vote down vote up
/**
 * Get the set of locales for which complex formats are available.  This
 * is the same set as the {@link NumberFormat} set. 
 * @return available complex format locales.
 */
public static Locale[] getAvailableLocales() {
    return NumberFormat.getAvailableLocales();
}
 
Example 10
Source File: Cardumen_0032_s.java    From coming with MIT License 2 votes vote down vote up
/**
 * Get the set of locales for which complex formats are available.  This
 * is the same set as the {@link NumberFormat} set. 
 * @return available complex format locales.
 */
public static Locale[] getAvailableLocales() {
    return NumberFormat.getAvailableLocales();
}
 
Example 11
Source File: BigFractionFormat.java    From astor with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Get the set of locales for which complex formats are available.  This
 * is the same set as the {@link NumberFormat} set.
 * @return available complex format locales.
 */
public static Locale[] getAvailableLocales() {
    return NumberFormat.getAvailableLocales();
}
 
Example 12
Source File: BtcFormat.java    From bcm-android with GNU General Public License v3.0 2 votes vote down vote up
/**
 * Return an array of all locales for which the getInstance() method of this class can
 * return localized instances.  See {@link NumberFormat#getAvailableLocales()}
 */
public static Locale[] getAvailableLocales() {
    return NumberFormat.getAvailableLocales();
}
 
Example 13
Source File: ComplexFormat.java    From astor with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Get the set of locales for which complex formats are available.
 * <p>This is the same set as the {@link NumberFormat} set.</p> 
 * @return available complex format locales.
 */
public static Locale[] getAvailableLocales() {
    return NumberFormat.getAvailableLocales();
}
 
Example 14
Source File: RealVectorFormat.java    From astor with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Get the set of locales for which real vectors formats are available.
 * <p>This is the same set as the {@link NumberFormat} set.</p>
 * @return available real vector format locales.
 */
public static Locale[] getAvailableLocales() {
    return NumberFormat.getAvailableLocales();
}
 
Example 15
Source File: FractionFormat.java    From astor with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Get the set of locales for which complex formats are available.  This
 * is the same set as the {@link NumberFormat} set.
 * @return available complex format locales.
 */
public static Locale[] getAvailableLocales() {
    return NumberFormat.getAvailableLocales();
}
 
Example 16
Source File: Vector3DFormat.java    From astor with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Get the set of locales for which 3D vectors formats are available.
 * <p>This is the same set as the {@link NumberFormat} set.</p>
 * @return available 3D vector format locales.
 */
public static Locale[] getAvailableLocales() {
    return NumberFormat.getAvailableLocales();
}
 
Example 17
Source File: FractionFormat.java    From astor with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Get the set of locales for which complex formats are available.  This
 * is the same set as the {@link NumberFormat} set. 
 * @return available complex format locales.
 */
public static Locale[] getAvailableLocales() {
    return NumberFormat.getAvailableLocales();
}
 
Example 18
Source File: RealMatrixFormat.java    From astor with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Get the set of locales for which real vectors formats are available.
 * <p>This is the same set as the {@link NumberFormat} set.</p>
 * @return available real vector format locales.
 */
public static Locale[] getAvailableLocales() {
    return NumberFormat.getAvailableLocales();
}
 
Example 19
Source File: Vector3DFormat.java    From astor with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Get the set of locales for which 3D vectors formats are available.
 * <p>This is the same set as the {@link NumberFormat} set.</p>
 * @return available 3D vector format locales.
 */
public static Locale[] getAvailableLocales() {
    return NumberFormat.getAvailableLocales();
}
 
Example 20
Source File: ComplexFormat.java    From astor with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Get the set of locales for which complex formats are available.
 * <p>This is the same set as the {@link NumberFormat} set.</p>
 * @return available complex format locales.
 */
public static Locale[] getAvailableLocales() {
    return NumberFormat.getAvailableLocales();
}