Workaround for #1250 (#1251)

Co-authored-by: etmatrix <etmatrix@etmatrix>
This commit is contained in:
etmatrix 2021-10-10 13:10:08 +02:00 committed by GitHub
parent fc9fb05b7c
commit e1f696449f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 1 deletions

View File

@ -21,6 +21,7 @@ package org.lsposed.manager.ui.fragment;
import android.content.Context;
import android.content.res.Configuration;
import android.content.res.Resources.NotFoundException;
import android.os.Build;
import android.os.Bundle;
import android.provider.Settings;
@ -321,11 +322,17 @@ public class SettingsFragment extends BaseFragment {
Configuration conf = ctx.getResources().getConfiguration();
Locale originalLocale = conf.getLocales().get(0);
conf.setLocale(Locale.ENGLISH);
final String reference = ctx.createConfigurationContext(conf).getString(id);
var lstLang = new ArrayList<String>();
lstLang.add(Locale.ENGLISH.getLanguage());
final String reference;
try {
reference = ctx.createConfigurationContext(conf).getString(id);
} catch(NotFoundException nfe) {
return lstLang; // return only english
}
for (String loc : ctx.getAssets().getLocales()) {
if (loc.isEmpty()) {
continue;