Bug 830782 - Homescreen is in English instead of Portuguese after flashed and Pt-BR is set in FTE. r=fabrice a=tef+
authorVivien Nicolas <vnicolas@mozilla.com>
Thu, 31 Jan 2013 15:58:11 +0100
changeset 120361 cbeab7da0e3aad6f051ddfd50a089c3265b01ae4
parent 120360 20bbf73921f4a9092189efb8ecde905939551786
child 120466 683b08dc1afd73e823f85c6352115d94e8df8168
push id24250
push uservnicolas@mozilla.com
push dateThu, 31 Jan 2013 14:58:28 +0000
treeherdermozilla-central@cbeab7da0e3a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfabrice, tef
bugs830782
milestone21.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 830782 - Homescreen is in English instead of Portuguese after flashed and Pt-BR is set in FTE. r=fabrice a=tef+
b2g/chrome/content/settings.js
--- a/b2g/chrome/content/settings.js
+++ b/b2g/chrome/content/settings.js
@@ -116,19 +116,27 @@ SettingsListener.observe('language.curre
   }
 
   let intl = '';
   try {
     intl = Services.prefs.getComplexValue(prefName,
                                           Ci.nsIPrefLocalizedString).data;
   } catch(e) {}
 
+  // Bug 830782 - Homescreen is in English instead of selected locale after
+  // the first run experience.
+  // In order to ensure the current intl value is reflected on the child
+  // process let's always write a user value, even if this one match the
+  // current localized pref value.
   if (!((new RegExp('^' + value + '[^a-z-_] *[,;]?', 'i')).test(intl))) {
-    Services.prefs.setCharPref(prefName, value + ', ' + intl);
+    value = value + ', ' + intl;
+  } else {
+    value = intl;
   }
+  Services.prefs.setCharPref(prefName, value);
 
   if (shell.hasStarted() == false) {
     shell.start();
   }
 });
 
 // =================== RIL ====================
 (function RILSettingsToPrefs() {