Fixed a bug with the language changer.

This commit is contained in:
Rashiq Ahmad 2013-12-16 17:13:41 +01:00
parent 9958ad4dc9
commit cef231059d
2 changed files with 13 additions and 3 deletions

View File

@ -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:

View File

@ -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;
}