Automatically pull system language

Only applies on first boot as the settings loader will override this value
This commit is contained in:
Konloch 2023-12-18 00:33:45 -07:00
parent cbeb990d3f
commit 141ea98548

AI 샘플 코드 생성 중입니다

Loading...

View File

@ -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;
}
}