Permalink
Browse files

check if langpack exists

  • Loading branch information...
1 parent fb92b85 commit 6700dc388956269b83d66ebed9da0e646f87c5eb @toniher toniher committed Mar 3, 2012
Showing with 20 additions and 2 deletions.
  1. BIN preferredlanguage.xpi
  2. +20 −2 preferredlanguage/lib/main.js
View
Binary file not shown.
@@ -414,12 +414,30 @@ function getLangpack(version, os, app, channel) {
var langpackurl = "http://ftp.mozilla.org/pub/"+app+"/releases/"+version+"/"+os+"/xpi/"+defaultlang+".xpi";
+ // First check if it exists
+ var Request = require("request").Request;
- tabs.open({
+ var testURL = Request({
url: langpackurl,
- inBackground: true
+ onComplete: function (response) {
+
+ if (response.status == 200 || response.status == 301 || response.status == 307) {
+ tabs.open({
+ url: langpackurl,
+ inBackground: true
+ });
+ }
+ else {
+ notifications.notify({
+ text: "No s'ha trobat un paquet d'idioma per a la vostra versió. Potser cal que actualitzeu el Firefox abans?",
+ iconURL: iconpopup
+ });
+ }
+ }
});
+ testURL.get();
+
}
}

0 comments on commit 6700dc3

Please sign in to comment.