Bug 1045053 - Part 1: set intl.accept_languages from Android OS/app locale. r=bnicholson
This commit is contained in:
@@ -9,7 +9,6 @@ import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
@@ -45,7 +44,6 @@ import org.mozilla.gecko.mozglue.GeckoLoader;
|
||||
import org.mozilla.gecko.preferences.ClearOnShutdownPref;
|
||||
import org.mozilla.gecko.preferences.GeckoPreferences;
|
||||
import org.mozilla.gecko.prompts.PromptService;
|
||||
import org.mozilla.gecko.SmsManager;
|
||||
import org.mozilla.gecko.updater.UpdateService;
|
||||
import org.mozilla.gecko.updater.UpdateServiceHelper;
|
||||
import org.mozilla.gecko.util.ActivityResultHandler;
|
||||
@@ -1207,6 +1205,9 @@ public abstract class GeckoApp
|
||||
// the UI.
|
||||
// This is using a sledgehammer to crack a nut, but it'll do for
|
||||
// now.
|
||||
// Our OS locale pref will be detected as invalid after the
|
||||
// restart, and will be propagated to Gecko accordingly, so there's
|
||||
// no need to touch that here.
|
||||
if (BrowserLocaleManager.getInstance().systemLocaleDidChange()) {
|
||||
Log.i(LOGTAG, "System locale changed. Restarting.");
|
||||
doRestart();
|
||||
@@ -1317,29 +1318,36 @@ public abstract class GeckoApp
|
||||
final String profilePath = getProfile().getDir().getAbsolutePath();
|
||||
final EventDispatcher dispatcher = EventDispatcher.getInstance();
|
||||
|
||||
// Both of these are Java-format locale strings: "en_US", not "en-US".
|
||||
final String osLocale = Locale.getDefault().toString();
|
||||
String appLocale = localeManager.getAndApplyPersistedLocale(GeckoApp.this);
|
||||
Log.d(LOGTAG, "OS locale is " + osLocale + ", app locale is " + appLocale);
|
||||
// This is the locale prior to fixing it up.
|
||||
final Locale osLocale = Locale.getDefault();
|
||||
|
||||
if (appLocale == null) {
|
||||
appLocale = osLocale;
|
||||
// Both of these are Java-format locale strings: "en_US", not "en-US".
|
||||
final String osLocaleString = osLocale.toString();
|
||||
String appLocaleString = localeManager.getAndApplyPersistedLocale(GeckoApp.this);
|
||||
Log.d(LOGTAG, "OS locale is " + osLocaleString + ", app locale is " + appLocaleString);
|
||||
|
||||
if (appLocaleString == null) {
|
||||
appLocaleString = osLocaleString;
|
||||
}
|
||||
|
||||
mHealthRecorder = GeckoApp.this.createHealthRecorder(GeckoApp.this,
|
||||
profilePath,
|
||||
dispatcher,
|
||||
osLocale,
|
||||
appLocale,
|
||||
osLocaleString,
|
||||
appLocaleString,
|
||||
previousSession);
|
||||
|
||||
final String uiLocale = appLocale;
|
||||
final String uiLocale = appLocaleString;
|
||||
ThreadUtils.postToUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
GeckoApp.this.onLocaleReady(uiLocale);
|
||||
}
|
||||
});
|
||||
|
||||
// We use per-profile prefs here, because we're tracking against
|
||||
// a Gecko pref. The same applies to the locale switcher!
|
||||
BrowserLocaleManager.storeAndNotifyOSLocale(GeckoSharedPrefs.forProfile(GeckoApp.this), osLocale);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user