mirror of
https://github.com/sirjonasxx/G-Earth.git
synced 2024-11-23 00:40:51 +01:00
Initial launch (no cache set) uses system language
This commit is contained in:
parent
7a456bd1f3
commit
7871f4dc2a
@ -69,4 +69,14 @@ public enum Language {
|
||||
.map(Language::asMenuItem)
|
||||
.toArray(MenuItem[]::new);
|
||||
}
|
||||
|
||||
public static Language getSystemLanguage() {
|
||||
String locale = System.getProperty("user.language");
|
||||
System.out.println(locale);
|
||||
for (Language l : values())
|
||||
if (l.locale.equals(locale))
|
||||
return l;
|
||||
|
||||
return ENGLISH;
|
||||
}
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ public class LanguageBundle extends ResourceBundle {
|
||||
try {
|
||||
current = Language.valueOf((String) Cacher.get(LANGUAGE_CACHE_KEY));
|
||||
} catch (Exception e) {
|
||||
current = Language.ENGLISH;
|
||||
current = Language.getSystemLanguage();
|
||||
Cacher.put(LANGUAGE_CACHE_KEY, current.toString());
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user