<?xml version="1.0"?>
<!--
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at https://mozilla.org/MPL/2.0/.
-->

<overlay id="enigmailCheckLanguage"
    xmlns:html="http://www.w3.org/1999/xhtml"
    xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">

  <script type="application/x-javascript">
  <![CDATA[
    window.addEventListener("load", function _enigmail_LanguageCheck()
      {
        var e = null;
        try {
          var strBundleService = Components.classes["@mozilla.org/intl/stringbundle;1"].getService();
          strBundleService = strBundleService.QueryInterface(Components.interfaces.nsIStringBundleService);
          var strBundle = strBundleService.createBundle("chrome://enigmail/locale/enigmail.properties");
          e = strBundle.GetStringFromName("Enigmail");
        }
        catch (ex) {}
        try {
          if (typeof(e) != "string") {
            var promptServ = Components.classes["@mozilla.org/embedcomp/prompt-service;1"].getService(Components.interfaces.nsIPromptService);
            promptServ.alert(window, "Enigmail Alert", "The language of Enigmail does not correspond to the language of your application! Enigmail can therefore NOT work.\n\nPlease install a language pack for Enigmail, available from the 'Language Packs' page on the Enigmail homepage (https://www.enigmail.net/download/langpack.php).\n\n");
          }
        } catch (ex) {
          // whatever happens, mozilla must continue to start up...
        }
      },
      false);
  ]]>
  </script>
</overlay>
