Skip to content

Commit

Permalink
Use correct language tags for script and regional language variants (#…
Browse files Browse the repository at this point in the history
…3716)

* Fix language tags so script and regional variants work correctly

* Adjust update_translations.sh language tags for script/regional variants

ACKs for top commit:
  @ripcurlx:
    ACK 0892327
  • Loading branch information
ripcurlx authored Dec 3, 2019
2 parents 51982fd + 0892327 commit d8e19c4
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 17 deletions.
22 changes: 7 additions & 15 deletions core/src/main/java/bisq/core/locale/LanguageUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ public class LanguageUtil {
"el", // Greek
"es", // Spanish
"pt", // Portuguese
"pt_BR", // Brazilian Portuguese
"zh", // Chinese
"pt-BR", // Portuguese (Brazil)
"zh-Hans", // Chinese [Han Simplified]
"ru", // Russian
"fr", // French
"vi", // Vietnamese
Expand All @@ -44,7 +44,7 @@ public class LanguageUtil {
"fa" // Persian
/*
// not translated yet
"sr", // Serbian
"sr-Latn-RS", // Serbian [Latin] (Serbia)
"hu", // Hungarian
"ro", // Romanian
"tr" // Turkish
Expand Down Expand Up @@ -112,24 +112,16 @@ public static String getDefaultLanguage() {
}

public static String getDefaultLanguageLocaleAsCode() {
return new Locale(LanguageUtil.getDefaultLanguage(), "").getLanguage();
return new Locale(LanguageUtil.getDefaultLanguage()).getLanguage();
}

public static String getEnglishLanguageLocaleCode() {
return new Locale(Locale.ENGLISH.getLanguage(), "").getLanguage();
return new Locale(Locale.ENGLISH.getLanguage()).getLanguage();
}

public static String getDisplayName(String code) {
Locale locale = new Locale(code.toUpperCase());
if (locale.getLanguage().equals("sr")) {
// Serbia
// shows it in russian by default
return "Srpski";
} else if (locale.getLanguage().equals("pt_br")) {
return "português (Brasil)";
} else {
return locale.getDisplayName(locale);
}
Locale locale = Locale.forLanguageTag(code);
return locale.getDisplayName(locale);
}

public static boolean isDefaultLanguageRTL() {
Expand Down
4 changes: 2 additions & 2 deletions core/update_translations.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ mv "$translations/es.properties" "$i18n/displayStrings_es.properties"
mv "$translations/ja.properties" "$i18n/displayStrings_ja.properties"
mv "$translations/pt.properties" "$i18n/displayStrings_pt.properties"
mv "$translations/ru.properties" "$i18n/displayStrings_ru.properties"
mv "$translations/zh_CN.properties" "$i18n/displayStrings_zh.properties"
mv "$translations/zh_CN.properties" "$i18n/displayStrings_zh-hans.properties"
mv "$translations/vi.properties" "$i18n/displayStrings_vi.properties"
mv "$translations/th_TH.properties" "$i18n/displayStrings_th.properties"
mv "$translations/fa.properties" "$i18n/displayStrings_fa.properties"
mv "$translations/fr.properties" "$i18n/displayStrings_fr.properties"
mv "$translations/pt_BR.properties" "$i18n/displayStrings_pt_BR.properties"
mv "$translations/pt_BR.properties" "$i18n/displayStrings_pt-br.properties"

rm -rf $translations

0 comments on commit d8e19c4

Please sign in to comment.