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:
Hans-Christoph Steiner 2017-04-18 23:12:43 +02:00
parent b2d89ec665
commit f224483e1b

View File

@ -47,6 +47,7 @@ public final class Languages {
activity.getWindowManager().getDefaultDisplay().getMetrics(ignored);
Resources resources;
Set<Locale> localeSet = new LinkedHashSet<>();
Locale currentLocale = config.locale;
for (Locale locale : LOCALES_TO_TEST) {
config.locale = locale;
resources = new Resources(assets, ignored, config);
@ -55,6 +56,8 @@ public final class Languages {
localeSet.add(locale);
}
}
config.locale = currentLocale;
for (Locale locale : localeSet) {
if (locale.equals(TIBETAN)) {
// 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. */
localeSet.add(null);
tmpMap.put(USE_SYSTEM_DEFAULT, activity.getString(resId));
nameMap = Collections.unmodifiableMap(tmpMap);
}
@ -137,8 +139,6 @@ public final class Languages {
config.locale = locale;
}
resources.updateConfiguration(config, resources.getDisplayMetrics());
Locale.setDefault(locale);
}
/**