diff --git a/src/org/openstreetmap/josm/tools/I18n.java b/src/org/openstreetmap/josm/tools/I18n.java index aa6a8a5652..e7f264169f 100644 --- a/src/org/openstreetmap/josm/tools/I18n.java +++ b/src/org/openstreetmap/josm/tools/I18n.java @@ -145,20 +145,25 @@ private enum PluralMode { languages.put("zh_TW", PluralMode.MODE_NONE); } - private static final String HIRAGANA = "hira"; - private static final String KATAKANA = "kana"; private static final String LATIN = "latn"; - private static final String PINYIN = "pinyin"; private static final String LATINPINYIN = "latn-pinyin"; + private static final String PINYIN = "pinyin"; private static final String ROMAJI = "rm"; - private static final String HANI = "hani"; + private static final String HIRAGANA = "hira"; + private static final String KATAKANA = "kana"; + private static final String BOPOMOFO = "bopo"; private static final String HANT = "hant"; + private static final String HANI = "hani"; private static final String HANS = "hans"; - private static final String BOPOMOFO = "bopo"; // Matches ISO-639 two and three letters language codes + scripts private static final Pattern LANGUAGE_NAMES = Pattern.compile( - "name:(\\p{Lower}{2,3})(?:[-_](?i:(" + String.join("|", HIRAGANA, KATAKANA, LATIN, PINYIN, LATINPINYIN, ROMAJI, HANI, HANS, HANT, BOPOMOFO) + ")))?"); + "name:(\\p{Lower}{2,3})(?:[-_](?i:(" + + String.join("|", + LATIN, LATINPINYIN, PINYIN, ROMAJI, + HIRAGANA, KATAKANA, BOPOMOFO, + HANI, HANT, HANS) + + ")))?"); private static String format(String text, Object... objects) { if (objects.length == 0 && !text.contains("'")) { @@ -719,24 +724,24 @@ public static Locale getOriginalLocale() { public static String getLocalizedScript(String script) { if (script != null) { switch (script.toLowerCase(Locale.ENGLISH)) { - case HIRAGANA: - return /* I18n: a Japanese syllabary */ tr("Hiragana"); - case KATAKANA: - return /* I18n: a Japanese syllabary */ tr("Katakana"); case LATIN: return /* I18n: usage of latin letters/script for usually non-latin languages */ tr("Latin"); case PINYIN: case LATINPINYIN: return /* I18n: official romanization system for Standard Chinese */ tr("Pinyin"); + case ROMAJI: + return /* I18n: a Japanese syllabary (latin script) */ tr("Rōmaji"); + case HIRAGANA: + return /* I18n: a Japanese syllabary */ tr("Hiragana"); + case KATAKANA: + return /* I18n: a Japanese syllabary */ tr("Katakana"); + case BOPOMOFO: + return /* I18n: Mandarin Phonetic Symbols/Zhuyin */ tr("Bopomofo"); case HANI: return /* I18n: Han characters for Vietnamese or Korean language */ tr("Hani"); case HANS: return /* I18n: Simplified Chinese */ tr("Simplied"); case HANT: return /* I18n: Traditional Chinese */ tr("Trdaditional"); - case BOPOMOFO: - return /* I18n: Mandarin Phonetic Symbols/Zhuyin */ tr("Bopomofo"); - case ROMAJI: - return /* I18n: a Japanese syllabary (latin script) */ tr("Rōmaji"); default: Logging.warn("Unsupported script: {0}", script); }