Fix empty default lang bug (#4608)

* Fix bug #4583

* Fix empty default lang bug
This commit is contained in:
Madhur Gupta 2021-09-10 13:22:24 +05:30 committed by GitHub
parent b41882639e
commit 174b4760ab
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -229,7 +229,10 @@ public class SettingsFragment extends PreferenceFragmentCompat {
/** /**
* Changing the default app language with selected one and save it to SharedPreferences * Changing the default app language with selected one and save it to SharedPreferences
*/ */
public void setLocale(final Activity activity, final String userSelectedValue) { public void setLocale(final Activity activity, String userSelectedValue) {
if (userSelectedValue.equals("")) {
userSelectedValue = Locale.getDefault().getLanguage();
}
final Locale locale = new Locale(userSelectedValue); final Locale locale = new Locale(userSelectedValue);
Locale.setDefault(locale); Locale.setDefault(locale);
final Configuration configuration = new Configuration(); final Configuration configuration = new Configuration();