Ignore:
Timestamp:
2018-08-29T21:15:20+02:00 (6 years ago)
Author:
Don-vip
Message:

fix #15696, see #16688 - Don't use the localized decimal separator for coordinates

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/coor/conversion/AbstractCoordinateFormat.java

    r12735 r14203  
    1717    protected final String displayName;
    1818
    19     /**
    20      * The normal number format for server precision coordinates
    21      */
    22     protected static final DecimalFormat cDdFormatter;
    23     static {
    24         // Don't use the localized decimal separator. This way we can present
    25         // a comma separated list of coordinates.
    26         cDdFormatter = (DecimalFormat) NumberFormat.getInstance(Locale.UK);
    27         cDdFormatter.applyPattern("###0.0######");
    28     }
    29 
     19    /** The normal number format for server precision coordinates */
     20    protected static final DecimalFormat cDdFormatter = newUnlocalizedDecimalFormat("###0.0######");
    3021    /** Character denoting South, as string */
    3122    protected static final String SOUTH = trc("compass", "S");
     
    4031        this.id = id;
    4132        this.displayName = displayName;
     33    }
     34
     35    /**
     36     * Creates a new unlocalized {@link DecimalFormat}.
     37     * By not using the localized decimal separator, we can present a comma separated list of coordinates.
     38     * @param pattern decimal format pattern
     39     * @return {@code DecimalFormat} using dot as decimal separator
     40     * @see DecimalFormat#applyPattern
     41     * @since 14203
     42     */
     43    public static DecimalFormat newUnlocalizedDecimalFormat(String pattern) {
     44        DecimalFormat format = (DecimalFormat) NumberFormat.getInstance(Locale.UK);
     45        format.applyPattern(pattern);
     46        return format;
    4247    }
    4348
Note: See TracChangeset for help on using the changeset viewer.