mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-12 10:49:06 +01:00
Improvements:
* Force LTR by prefixing language names with the LRM marker * Add Polish * Cleanup
This commit is contained in:
@@ -22,10 +22,8 @@ public class Localizer {
|
||||
private static Localizer INSTANCE;
|
||||
@Nullable
|
||||
private final Locale locale;
|
||||
private final SharedPreferences sharedPreferences;
|
||||
|
||||
private Localizer(SharedPreferences prefs) {
|
||||
this.sharedPreferences = prefs;
|
||||
private Localizer(SharedPreferences sharedPreferences) {
|
||||
locale = getLocaleFromTag(
|
||||
sharedPreferences.getString(LANGUAGE, "default"));
|
||||
}
|
||||
@@ -41,10 +39,6 @@ public class Localizer {
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
public SharedPreferences getSharedPreferences() {
|
||||
return sharedPreferences;
|
||||
}
|
||||
|
||||
// Get Locale from BCP-47 tag
|
||||
@Nullable
|
||||
public static Locale getLocaleFromTag(String tag) {
|
||||
|
||||
@@ -4,7 +4,6 @@ import android.annotation.TargetApi;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.media.Ringtone;
|
||||
import android.media.RingtoneManager;
|
||||
import android.net.Uri;
|
||||
@@ -211,8 +210,9 @@ public class SettingsFragment extends PreferenceFragmentCompat
|
||||
if (!tmp.isEmpty() && !tmp.equals(nativeName))
|
||||
nativeName = tmp;
|
||||
}
|
||||
// Prefix with LRM marker to prevent any RTL direction
|
||||
nativeNames[i] =
|
||||
nativeName.substring(0, 1).toUpperCase() +
|
||||
"\u200E" + nativeName.substring(0, 1).toUpperCase() +
|
||||
nativeName.substring(1);
|
||||
}
|
||||
language.setEntries(nativeNames);
|
||||
@@ -397,10 +397,6 @@ public class SettingsFragment extends PreferenceFragmentCompat
|
||||
builder.setPositiveButton(R.string.sign_out_button,
|
||||
(dialogInterface, i) -> {
|
||||
language.setValue(newValue);
|
||||
SharedPreferences prefs =
|
||||
Localizer.getInstance().getSharedPreferences();
|
||||
prefs.edit().putString(LANGUAGE, newValue)
|
||||
.commit();
|
||||
Intent intent = new Intent(getContext(),
|
||||
NavDrawerActivity.class);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||
|
||||
@@ -41,6 +41,7 @@
|
||||
<item>nb</item>
|
||||
<item>nl</item>
|
||||
<item>oc</item>
|
||||
<item>pl</item>
|
||||
<item>pt-BR</item>
|
||||
<item>ro</item>
|
||||
<item>ru</item>
|
||||
|
||||
Reference in New Issue
Block a user