From 35642b465f61bcab002c7bc4c69eea21259359ee Mon Sep 17 00:00:00 2001 From: Simon Kornblith Date: Sun, 22 Jan 2012 11:17:42 -0500 Subject: [PATCH] Fix for broken locale retrieval with Ubuntu Firefox Modifications --- chrome/content/zotero/xpcom/zotero.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/chrome/content/zotero/xpcom/zotero.js b/chrome/content/zotero/xpcom/zotero.js index b0af143ee0..4a5767b78b 100644 --- a/chrome/content/zotero/xpcom/zotero.js +++ b/chrome/content/zotero/xpcom/zotero.js @@ -257,8 +257,18 @@ const ZOTERO_CONFIG = { // Locale var prefs = Components.classes["@mozilla.org/preferences-service;1"] - .getService(Components.interfaces.nsIPrefService); - this.locale = prefs.getBranch("general.useragent.").getCharPref("locale"); + .getService(Components.interfaces.nsIPrefService), + uaPrefs = prefs.getBranch("general.useragent."); + try { + this.locale = uaPrefs.getComplexValue("locale", Components.interfaces.nsIPrefLocalizedString); + } catch (e) {} + + if(this.locale) { + this.locale = this.locale.toString(); + } else { + this.locale = uaPrefs.getCharPref("locale"); + } + if (this.locale.length == 2) { this.locale = this.locale + '-' + this.locale.toUpperCase(); }