diff options
5 files changed, 14 insertions, 10 deletions
diff --git a/android/source/res/values/arrays.xml b/android/source/res/values/arrays.xml index b1b61ef89b2f..edea6443b419 100644 --- a/android/source/res/values/arrays.xml +++ b/android/source/res/values/arrays.xml @@ -14,6 +14,7 @@ <item >3</item> </string-array> <string-array name="SupportedLanguagesValues"> + <item>SYSTEM_DEFAULT_LANGUAGE</item> <item >de</item> <item >en</item> <item >tr</item> @@ -43,6 +44,7 @@ <item>@string/filter_drawings</item> </string-array> <string-array name="SupportedLanguages"> + <item>(System Default)</item> <item>Deutsch</item> <item>English</item> <item>Turkçe</item> diff --git a/android/source/res/xml/libreoffice_preferences.xml b/android/source/res/xml/libreoffice_preferences.xml index cf1d306866cf..d02c9d5cccbc 100644 --- a/android/source/res/xml/libreoffice_preferences.xml +++ b/android/source/res/xml/libreoffice_preferences.xml @@ -30,7 +30,7 @@ android:summary="@string/display_language_summary" android:entries="@array/SupportedLanguages" android:entryValues="@array/SupportedLanguagesValues" - android:defaultValue="en" + android:defaultValue="SYSTEM_DEFAULT_LANGUAGE" android:key="DISPLAY_LANGUAGE" /> diff --git a/android/source/src/java/org/libreoffice/LibreOfficeApplication.java b/android/source/src/java/org/libreoffice/LibreOfficeApplication.java index 07c14663860e..cb79219fc999 100644 --- a/android/source/src/java/org/libreoffice/LibreOfficeApplication.java +++ b/android/source/src/java/org/libreoffice/LibreOfficeApplication.java @@ -28,6 +28,6 @@ public class LibreOfficeApplication extends Application { @Override protected void attachBaseContext(Context base) { - super.attachBaseContext(LocaleHelper.onAttach(base, "en")); + super.attachBaseContext(LocaleHelper.onAttach(base)); } } diff --git a/android/source/src/java/org/libreoffice/LocaleHelper.java b/android/source/src/java/org/libreoffice/LocaleHelper.java index 26a31e431397..8c0e9b3fbbed 100644 --- a/android/source/src/java/org/libreoffice/LocaleHelper.java +++ b/android/source/src/java/org/libreoffice/LocaleHelper.java @@ -12,17 +12,14 @@ import java.util.Locale; public class LocaleHelper { private static final String SELECTED_LANG = "org.libreoffice.selected.lang"; + // value for language that indicates that system's default language should be used + public static final String SYSTEM_DEFAULT_LANGUAGE = "SYSTEM_DEFAULT_LANGUAGE"; public static Context onAttach(Context context){ String lang = getPersistedData(context, Locale.getDefault().getLanguage()); return setLocale(context, lang); } - public static Context onAttach(Context context, String defLang){ - String lang = getPersistedData(context, defLang); - return setLocale(context, lang); - } - public static Context setLocale(Context context, String lang) { persist(context, lang); return updateResources(context, lang); @@ -30,7 +27,12 @@ public class LocaleHelper { @SuppressWarnings("deprecation") private static Context updateResources(Context context, String lang) { - Locale locale = new Locale(lang); + Locale locale; + if (lang.equals(SYSTEM_DEFAULT_LANGUAGE)) { + locale = Locale.getDefault(); + } else { + locale = new Locale(lang); + } Locale.setDefault(locale); Resources res = context.getResources(); diff --git a/android/source/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java b/android/source/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java index 3fb715e46778..a9d797c4bf28 100644 --- a/android/source/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java +++ b/android/source/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java @@ -178,7 +178,7 @@ public class LibreOfficeUIActivity extends AppCompatActivity implements Settings @Override protected void attachBaseContext(Context newBase) { - super.attachBaseContext(LocaleHelper.onAttach(newBase,"en")); + super.attachBaseContext(LocaleHelper.onAttach(newBase)); } public void createUI() { @@ -842,7 +842,7 @@ public class LibreOfficeUIActivity extends AppCompatActivity implements Settings viewMode = Integer.valueOf(defaultPrefs.getString(EXPLORER_VIEW_TYPE_KEY, ""+ GRID_VIEW)); filterMode = Integer.valueOf(defaultPrefs.getString(FILTER_MODE_KEY , "-1")); showHiddenFiles = defaultPrefs.getBoolean(ENABLE_SHOW_HIDDEN_FILES_KEY, false); - displayLanguage = defaultPrefs.getString(DISPLAY_LANGUAGE, "en"); + displayLanguage = defaultPrefs.getString(DISPLAY_LANGUAGE, LocaleHelper.SYSTEM_DEFAULT_LANGUAGE); Intent i = this.getIntent(); if (i.hasExtra(CURRENT_DIRECTORY_KEY)) { |