diff --git a/build-android-with-native.py b/build-android-with-native.py index 197e6ea0d..33da53112 100755 --- a/build-android-with-native.py +++ b/build-android-with-native.py @@ -29,6 +29,7 @@ USAGE = '''Usage: %s [--option] --kiwix Compile libkiwix --strip Strip libkiwix.so --apk Create an APK file + --locales Create the locales.txt file Note that the '--' prefix is optionnal. @@ -518,8 +519,7 @@ for arch in ARCHS: change_env(ORIGINAL_ENVIRON) if COMPILE_APK: - # create locales.txt - # create_locales.write_locales(create_locales.get_all_language_codes()) + syscall('rm -f bin/*.apk', shell=True) syscall('ant debug') syscall('ls -lh bin/*.apk', shell=True) @@ -540,7 +540,7 @@ if LOCALES_TXT: with open(os.path.join(curdir, 'assets', 'locales.txt'), 'w') as f: f.write(',\n'.join(files)) - + print 'Created locales.txt file.' # check that the step went well if COMPILE_APK: diff --git a/src/org/kiwix/kiwixmobile/LanguageUtils.java b/src/org/kiwix/kiwixmobile/LanguageUtils.java index 287ec48c5..27abe5d37 100644 --- a/src/org/kiwix/kiwixmobile/LanguageUtils.java +++ b/src/org/kiwix/kiwixmobile/LanguageUtils.java @@ -1,9 +1,11 @@ package org.kiwix.kiwixmobile; import android.content.Context; +import android.content.SharedPreferences; import android.graphics.Color; import android.graphics.Typeface; import android.os.Handler; +import android.preference.PreferenceManager; import android.util.AttributeSet; import android.util.Log; import android.view.InflateException; @@ -83,6 +85,14 @@ public class LanguageUtils { return false; } + + // Don't change the language, if the options hasn't been set + SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(mContext); + String language = prefs.getString("pref_language_chooser", ""); + + if (language.isEmpty()) { + return false; + } } return true; }