Skip to content

Commit

Permalink
Update I18n.java
Browse files Browse the repository at this point in the history
  • Loading branch information
verdy-p authored Oct 15, 2024
1 parent b51ab9a commit 1241336
Showing 1 changed file with 19 additions and 14 deletions.
33 changes: 19 additions & 14 deletions src/org/openstreetmap/josm/tools/I18n.java
Original file line number Diff line number Diff line change
Expand Up @@ -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("'")) {
Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit 1241336

Please sign in to comment.