Automatically pull system language
Only applies on first boot as the settings loader will override this value
This commit is contained in:
parent
cbeb990d3f
commit
141ea98548
|
@ -2,6 +2,8 @@ package the.bytecode.club.bytecodeviewer;
|
|||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Locale;
|
||||
|
||||
import the.bytecode.club.bytecodeviewer.bootloader.BootState;
|
||||
import the.bytecode.club.bytecodeviewer.gui.theme.LAFTheme;
|
||||
import the.bytecode.club.bytecodeviewer.gui.theme.RSTATheme;
|
||||
|
@ -83,7 +85,7 @@ public class Configuration
|
|||
public static boolean verifyCorruptedStateOnBoot = false; //eventually may be a setting
|
||||
|
||||
public static BootState bootState = BootState.START_UP;
|
||||
public static Language language = Language.ENGLISH;
|
||||
public static Language language = guessBestLanguage();
|
||||
public static LAFTheme lafTheme = LAFTheme.DARK;
|
||||
public static RSTATheme rstaTheme = lafTheme.getRSTATheme();
|
||||
public static long lastHotKeyExecuted = 0;
|
||||
|
@ -138,4 +140,17 @@ public class Configuration
|
|||
return new File(".");
|
||||
}
|
||||
|
||||
public static Language guessBestLanguage()
|
||||
{
|
||||
Locale systemLocale = Locale.getDefault();
|
||||
String systemLanguage = systemLocale.getLanguage();
|
||||
|
||||
Language language = Language.getLanguageCodeLookup().get(systemLanguage);
|
||||
|
||||
if(language != null)
|
||||
return language;
|
||||
|
||||
//fallback to english
|
||||
return Language.ENGLISH;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user