when checking language support, reset locale back to original
With this, it was leaving the app's locale set to the last language on the LOCALES_TO_TEST list, which is 'zu' (Zulu). For some dialogs, it was actually using that locale, so showing OK/Cancel in Zulu despite the app being in a different language. #943
This commit is contained in:
parent
b2d89ec665
commit
f224483e1b
@ -47,6 +47,7 @@ public final class Languages {
|
|||||||
activity.getWindowManager().getDefaultDisplay().getMetrics(ignored);
|
activity.getWindowManager().getDefaultDisplay().getMetrics(ignored);
|
||||||
Resources resources;
|
Resources resources;
|
||||||
Set<Locale> localeSet = new LinkedHashSet<>();
|
Set<Locale> localeSet = new LinkedHashSet<>();
|
||||||
|
Locale currentLocale = config.locale;
|
||||||
for (Locale locale : LOCALES_TO_TEST) {
|
for (Locale locale : LOCALES_TO_TEST) {
|
||||||
config.locale = locale;
|
config.locale = locale;
|
||||||
resources = new Resources(assets, ignored, config);
|
resources = new Resources(assets, ignored, config);
|
||||||
@ -55,6 +56,8 @@ public final class Languages {
|
|||||||
localeSet.add(locale);
|
localeSet.add(locale);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
config.locale = currentLocale;
|
||||||
|
|
||||||
for (Locale locale : localeSet) {
|
for (Locale locale : localeSet) {
|
||||||
if (locale.equals(TIBETAN)) {
|
if (locale.equals(TIBETAN)) {
|
||||||
// include English name for devices without Tibetan font support
|
// include English name for devices without Tibetan font support
|
||||||
@ -71,7 +74,6 @@ public final class Languages {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* SYSTEM_DEFAULT is a fake one for displaying in a chooser menu. */
|
/* SYSTEM_DEFAULT is a fake one for displaying in a chooser menu. */
|
||||||
localeSet.add(null);
|
|
||||||
tmpMap.put(USE_SYSTEM_DEFAULT, activity.getString(resId));
|
tmpMap.put(USE_SYSTEM_DEFAULT, activity.getString(resId));
|
||||||
nameMap = Collections.unmodifiableMap(tmpMap);
|
nameMap = Collections.unmodifiableMap(tmpMap);
|
||||||
}
|
}
|
||||||
@ -137,8 +139,6 @@ public final class Languages {
|
|||||||
config.locale = locale;
|
config.locale = locale;
|
||||||
}
|
}
|
||||||
resources.updateConfiguration(config, resources.getDisplayMetrics());
|
resources.updateConfiguration(config, resources.getDisplayMetrics());
|
||||||
Locale.setDefault(locale);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user