v2.0.0: fixed errors when English was selected on non-English devices

This commit is contained in:
Evan Debenham
2023-02-09 17:40:19 -05:00
parent e10fb89c22
commit 1225df283b
@@ -33,6 +33,8 @@ import java.util.HashSet;
import java.util.IllegalFormatException; import java.util.IllegalFormatException;
import java.util.Locale; import java.util.Locale;
import jdk.vm.ci.meta.Local;
/* /*
Simple wrapper class for libGDX I18NBundles. Simple wrapper class for libGDX I18NBundles.
@@ -80,7 +82,7 @@ public class Messages {
//seeing as missing keys are part of our process, this is faster than throwing an exception //seeing as missing keys are part of our process, this is faster than throwing an exception
I18NBundle.setExceptionOnMissingKey(false); I18NBundle.setExceptionOnMissingKey(false);
bundles = new ArrayList<>(); //store language and locale info for various string logic
Messages.lang = lang; Messages.lang = lang;
if (lang == Languages.ENGLISH){ if (lang == Languages.ENGLISH){
locale = Locale.ENGLISH; locale = Locale.ENGLISH;
@@ -88,8 +90,11 @@ public class Messages {
locale = new Locale(lang.code()); locale = new Locale(lang.code());
} }
//strictly match the language code when fetching bundles however
bundles = new ArrayList<>();
Locale bundleLocal = new Locale(lang.code());
for (String file : prop_files) { for (String file : prop_files) {
bundles.add(I18NBundle.createBundle(Gdx.files.internal(file), locale)); bundles.add(I18NBundle.createBundle(Gdx.files.internal(file), bundleLocal));
} }
} }