Correct locales logic to get some kind of ISO 639-3 support, update pom, make ja_ryu appear (unfortunately as 'Japanese' language and not as 'Central Okinawan')
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Dmitry Isaenko 2022-10-11 17:04:55 +03:00
parent 9aa4551ef0
commit 8b23b8967b
5 changed files with 15 additions and 15 deletions

View file

@ -55,7 +55,9 @@ Sometimes I add new posts about this project [on my blog page](https://developer
* Czech by [Spenaat](https://github.com/spenaat)
* Arabic by [eslamabdel](https://github.com/eslamabdel)
* Romanian by [Călin Ilie](https://github.com/calini)
* Swedish by [Daniel Nylander](https://github.com/yeager) - (coming soon)
* Swedish by [Daniel Nylander](https://github.com/yeager)
* Japanese by [kuragehime](https://github.com/kuragehimekurara1)
* Ryukyuan languages by [kuragehime](https://github.com/kuragehimekurara1)
### System requirements
@ -71,7 +73,7 @@ JDK 11 for MacOS and Linux
| v0.6.1 | v0.6 |
| v0.7 - 0.7.3 | v0.7+ |
| v0.8 - 0.9 | v1.0+ |
| v0.10 | v6.0 |
| v0.10 | v6.0+ |
where '+' means 'any next NS-USBloader version'.

View file

@ -8,7 +8,7 @@
<name>NS-USBloader</name>
<artifactId>ns-usbloader</artifactId>
<version>6.1</version>
<version>6.2</version>
<url>https://redrise.ru</url>
<description>

View file

@ -32,7 +32,7 @@ public class AppPreferences {
private AppPreferences(){
this.preferences = Preferences.userRoot().node("NS-USBloader");
String localeCode = preferences.get("locale", Locale.getDefault().toString());
this.locale = new Locale(localeCode.substring(0, 2), localeCode.substring(3, 5));
this.locale = new Locale(localeCode.substring(0, 2), localeCode.substring(3));
}
public String getTheme(){

View file

@ -1,5 +1,5 @@
/*
Copyright 2019-2020 Dmitry Isaenko
Copyright 2019-2022 Dmitry Isaenko
This file is part of NS-USBloader.
@ -26,16 +26,14 @@ public class LocaleHolder {
private final String localeCode;
private final String languageName;
public LocaleHolder(Locale locale){
this.locale = locale;
this.localeCode = locale.toString();
this.languageName = locale.getDisplayLanguage(locale) + " (" + locale + ")";
}
public LocaleHolder(String localeFileName) {
String country = localeFileName.substring(7, 9);
String language = localeFileName.substring(10, 12);
this.locale = new Locale(country, language);
String language = localeFileName.substring(7, 9);
String country;
if (localeFileName.length() > 23) // ISO 639-3 not supported by Java
country = localeFileName.substring(10, localeFileName.indexOf('.'));
else // ISO 639-1
country = localeFileName.substring(10, 12);
this.locale = new Locale(language, country);
this.localeCode = locale.toString();
this.languageName = locale.getDisplayLanguage(locale) + " (" + locale + ")";
}
@ -47,7 +45,7 @@ public class LocaleHolder {
public String getLocaleCode(){
return localeCode;
};
}
public Locale getLocale() {
return locale;