Skip to content

Commit

Permalink
Automatically pull system language
Browse files Browse the repository at this point in the history
Only applies on first boot as the settings loader will override this value
  • Loading branch information
Konloch committed Dec 18, 2023
1 parent cbeb990 commit 141ea98
Showing 1 changed file with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -138,4 +140,17 @@ public static File getLastPluginDirectory()
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;
}
}

0 comments on commit 141ea98

Please sign in to comment.