Skip to content

Commit

Permalink
Fixes #300 Where Locale is set to Zulu when settings are opened
Browse files Browse the repository at this point in the history
  • Loading branch information
bitmold committed Apr 8, 2020
1 parent 8a3727a commit 29541f3
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 23 deletions.
18 changes: 1 addition & 17 deletions app/src/main/java/org/torproject/android/settings/Languages.java
Expand Up @@ -71,9 +71,8 @@ private Languages(Activity activity) {
DisplayMetrics ignored = new DisplayMetrics();
activity.getWindowManager().getDefaultDisplay().getMetrics(ignored);
Resources resources;
Set<Locale> localeSet = new LinkedHashSet<Locale>();
Set<Locale> localeSet = new LinkedHashSet<>();
for (Locale locale : localesToTest) {
config.locale = locale;
resources = new Resources(assets, ignored, config);
if (!TextUtils.equals(defaultString, resources.getString(resId))
|| locale.equals(Locale.ENGLISH))
Expand Down Expand Up @@ -192,21 +191,6 @@ public static void forceChangeLanguage(Activity activity) {
activity.overridePendingTransition(0, 0);
}

/**
* Return the name of the language based on the locale.
*
* @param locale
* @return
*/
public String getName(String locale) {
String ret = nameMap.get(locale);
// if no match, try to return a more general name (i.e. English for
// en_IN)
if (ret == null && locale.contains("_"))
ret = nameMap.get(locale.split("_")[0]);
return ret;
}

/**
* Return an array of the names of all the supported languages, sorted to
* match what is returned by {@link Languages#getSupportedLocales()}.
Expand Down
Expand Up @@ -20,8 +20,6 @@
*/
public class LocaleHelper {

private static final String SELECTED_LANGUAGE = "Locale.Helper.Selected.Language";

public static Context onAttach(Context context) {
String lang = getPersistedData(context, Locale.getDefault().getLanguage());
return setLocale(context, lang);
Expand All @@ -32,10 +30,6 @@ public static Context onAttach(Context context, String defaultLanguage) {
return setLocale(context, lang);
}

public static String getLanguage(Context context) {
return getPersistedData(context, Locale.getDefault().getLanguage());
}

public static Context setLocale(Context context, String language) {
persist(context, language);

Expand Down

0 comments on commit 29541f3

Please sign in to comment.