source: josm/trunk/src/org/openstreetmap/josm/tools/JosmDecimalFormatSymbolsProvider.java @ 12931

Last change on this file since 12931 was 12931, checked in by Don-vip, 2 months ago

see #14602 - Override digit group separator to be consistent across languages with ISO 80000-1 + checkstyle fixes

  • Property svn:eol-style set to native
File size: 1.2 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.tools;
3
4import java.text.DecimalFormatSymbols;
5import java.text.spi.DecimalFormatSymbolsProvider;
6import java.util.Locale;
7
8/**
9 * JOSM implementation of the {@link java.text.DecimalFormatSymbols DecimalFormatSymbols} class,
10 * consistent with ISO 80000-1.
11 * This class will only be used with Java 9 and later runtimes, as Java 8 implementation relies
12 * on Java Extension Mechanism only, while Java 9 supports application classpath.
13 * See {@link java.util.spi.LocaleServiceProvider LocaleServiceProvider} javadoc for more details.
14 * @since 12931
15 */
16public class JosmDecimalFormatSymbolsProvider extends DecimalFormatSymbolsProvider {
17
18    @Override
19    public DecimalFormatSymbols getInstance(Locale locale) {
20        DecimalFormatSymbols symbols = new DecimalFormatSymbols(locale);
21        // Override digit group separator to be consistent across languages with ISO 80000-1, chapter 7.3.1
22        symbols.setGroupingSeparator('\u202F'); // U+202F: NARROW NO-BREAK SPACE
23        return symbols;
24    }
25
26    @Override
27    public Locale[] getAvailableLocales() {
28        return I18n.getAvailableTranslations();
29    }
30}
Note: See TracBrowser for help on using the repository browser.