[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [torbutton/master] Properly use nsIPrefLocalizedString in torbutton_get_general_useragent_locale()
commit 84e8dbc93a59c5d60e472628f1fbfc45713fe569
Author: Jérémy Bobbio <lunar@xxxxxxxxxx>
Date: Sat Oct 1 18:11:30 2011 +0200
Properly use nsIPrefLocalizedString in torbutton_get_general_useragent_locale()
Replace the custom dereferencing of the stringbundle by the proper usage of
nsIPrefLocalizedString.
---
src/chrome/content/torbutton.js | 11 ++---------
1 files changed, 2 insertions(+), 9 deletions(-)
diff --git a/src/chrome/content/torbutton.js b/src/chrome/content/torbutton.js
index 8511fc0..a884ba2 100644
--- a/src/chrome/content/torbutton.js
+++ b/src/chrome/content/torbutton.js
@@ -1238,15 +1238,8 @@ function torbutton_set_timezone(mode, startup) {
function torbutton_get_general_useragent_locale() {
try {
- var locale = m_tb_prefs.getCharPref("general.useragent.locale");
- if (locale != "chrome://global/locale/intl.properties") {
- return locale;
- }
-
- var bundle = Components.classes["@mozilla.org/intl/stringbundle;1"]
- .getService(Components.interfaces.nsIStringBundleService);
- var stringbundle = bundle.createBundle(locale);
- return stringbundle.GetStringFromName("general.useragent.locale");
+ return m_tb_prefs.getComplexValue("general.useragent.locale",
+ Components.interfaces.nsIPrefLocalizedString).data;
} catch(err) {
torbutton_log(4, "Error while getting general.useragent.locale:" + err);
return 'en-US';
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits