summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTails developers <amnesia@boum.org>2011-12-22 14:18:19 +0100
committerTails developers <amnesia@boum.org>2011-12-22 14:23:17 +0100
commite04a6b7439f8b4de71d65cc474e71a71aef0ad59 (patch)
tree51cd288a211ba0c45766194a5294ecc5218878f3
parent075618d09d0e5b145c07192d195d58ba56f11e86 (diff)
Make the *correct* (i.e. localized) warning page show.
general.useragent.locale has a weird value when it's set to the default, so the previous approach only worked when it had a user set value (which naturally was the way it was tested...). Now we work around this weirdness.
-rw-r--r--content/Core/misc.js25
1 files changed, 18 insertions, 7 deletions
diff --git a/content/Core/misc.js b/content/Core/misc.js
index a1aba55..5f36978 100644
--- a/content/Core/misc.js
+++ b/content/Core/misc.js
@@ -311,11 +311,22 @@ FireGPG.Misc = {
Opens a warning about FireGPG from the Tails documentation
*/
showTailsDocWarning:function () {
- var prefs = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
+ var prefs = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
+ var locale = prefs.getCharPref("general.useragent.locale");
+ if (locale == "chrome://global/locale/intl.properties") {
+ // the pref "general.useragent.locale" is set to
+ // "chrome://global/locale/intl.properties" by default so we
+ // have to do the following weirdness as a work-around. See:
+ // http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=595375
+ var bundle = Components.classes["@mozilla.org/intl/stringbundle;1"].getService(Components.interfaces.nsIStringBundleService);
+ var stringbundle = bundle.createBundle(locale);
+ var lang = stringbundle.GetStringFromName("general.useragent.locale").substring(0,2);
+ } else {
+ var lang = locale.substring(0,2);
+ }
- lang = prefs.getCharPref("general.useragent.locale").substring(0,2);
- var url_prefix = "file:///usr/share/doc/tails/website/doc/encryption_and_privacy/FireGPG_susceptible_to_devastating_attacks.";
- var url = url_prefix + lang + ".html"
+ var url_prefix = "file:///usr/share/doc/tails/website/doc/encryption_and_privacy/FireGPG_susceptible_to_devastating_attacks.";
+ var url = url_prefix + lang + ".html"
try {
client = new XMLHttpRequest();
@@ -323,12 +334,12 @@ FireGPG.Misc = {
client.send();
}
catch (err) {
- // file didn't exist, default to english
+ // file didn't exist, default to english
url = url_prefix + "en.html";
}
- var window = Components.classes['@mozilla.org/appshell/window-mediator;1'].getService(Components.interfaces.nsIWindowMediator).getMostRecentWindow('navigator:browser');
- window.gBrowser.selectedTab = window.gBrowser.addTab(url);
+ var window = Components.classes['@mozilla.org/appshell/window-mediator;1'].getService(Components.interfaces.nsIWindowMediator).getMostRecentWindow('navigator:browser');
+ window.gBrowser.selectedTab = window.gBrowser.addTab(url);
},
/*