Remove language region

Fixes #567
This commit is contained in:
Jakob Nixdorf 2020-09-25 07:47:52 +02:00
parent 12d81e2135
commit 129c07f9d9
No known key found for this signature in database
GPG key ID: BE99BF86574A7DBC
131 changed files with 38 additions and 40 deletions

View file

@ -435,7 +435,7 @@ public class MainActivity extends BaseActivity
} else if (key.equals(getString(R.string.settings_key_tap_single)) ||
key.equals(getString(R.string.settings_key_tap_double)) ||
key.equals(getString(R.string.settings_key_theme)) ||
key.equals(getString(R.string.settings_key_locale)) ||
key.equals(getString(R.string.settings_key_lang)) ||
key.equals(getString(R.string.settings_key_enable_screenshot)) ||
key.equals(getString(R.string.settings_key_tag_functionality)) ||
key.equals(getString(R.string.settings_key_label_highlight_token)) ||

View file

@ -146,7 +146,7 @@ public class SettingsActivity extends BaseActivity
backupManager.dataChanged();
if (key.equals(getString(R.string.settings_key_theme)) ||
key.equals(getString(R.string.settings_key_locale)) ||
key.equals(getString(R.string.settings_key_lang)) ||
key.equals(getString(R.string.settings_key_special_features)) ||
key.equals(getString(R.string.settings_key_backup_location))) {
recreate();

View file

@ -48,8 +48,8 @@ import static org.shadowice.flocke.andotp.Utilities.Constants.EncryptionType;
import static org.shadowice.flocke.andotp.Utilities.Constants.SortMode;
public class Settings {
private static final List<String> oldLangs = Arrays.asList("system", "en", "cs", "de", "es", "fr", "gl", "nl", "pl", "ru", "zh");
private static final List<String> newLangs = Arrays.asList("system", "en_US", "cs_CZ", "de_DE", "es_ES", "fr_FR", "gl_ES", "nl_NL", "pl_PL", "ru_RU", "zh_CN");
private static final List<String> newLangs = Arrays.asList("ar", "bg", "ca", "cs", "de", "el", "en", "es", "fa", "fr", "gl", "hi", "hu", "it", "ja", "nl", "pl", "pt_BR", "ru", "sl", "sv", "tr", "uk", "zh_CN", "zh_TW");
private static final List<String> oldLangs = Arrays.asList("ar_SA", "bg_BG", "ca_ES", "cs_CZ", "de_DE", "el_GR", "en_US", "es_ES", "fa_IR", "fr_FR", "gl_ES", "hi_IN", "hu_HU", "it_IT", "ja_JP", "nl_NL", "pl_PL", "pt_BR", "ru_RU", "sl_SI", "sv_SE", "tr_TR", "uk_UA", "zh_CN", "zh_TW");
private Context context;
private SharedPreferences settings;
@ -72,13 +72,13 @@ public class Settings {
remove(R.string.settings_key_auth_pin);
}
if (settings.contains(getResString(R.string.settings_key_lang))) {
String lang = getString(R.string.settings_key_lang, R.string.settings_default_locale);
if (settings.contains(getResString(R.string.settings_key_locale))) {
String lang = getString(R.string.settings_key_locale, R.string.settings_default_lang);
if (oldLangs.contains(lang))
setLocale(newLangs.get(oldLangs.indexOf(lang)));
remove(R.string.settings_key_lang);
remove(R.string.settings_key_locale);
}
if (settings.contains(getResString(R.string.settings_key_tap_to_reveal))) {
@ -320,11 +320,11 @@ public class Settings {
}
public void setLocale(String locale) {
setString(R.string.settings_key_locale, locale);
setString(R.string.settings_key_lang, locale);
}
public Locale getLocale() {
String lang = getString(R.string.settings_key_locale, R.string.settings_default_locale);
String lang = getString(R.string.settings_key_lang, R.string.settings_default_lang);
if (lang.equals("system")) {
return Tools.getSystemLocale();

Some files were not shown because too many files have changed in this diff Show more