Commit 9e8c034b authored by JC Brand's avatar JC Brand

Handle cases where Jed and/or Strophe.disco aren't available

parent 56c5a9c8
...@@ -56,7 +56,9 @@ ...@@ -56,7 +56,9 @@
}; };
_converse.registerPongHandler = function () { _converse.registerPongHandler = function () {
_converse.connection.disco.addFeature(Strophe.NS.PING); if (!_.isUndefined(_converse.connection.disco)) {
_converse.connection.disco.addFeature(Strophe.NS.PING);
}
_converse.connection.ping.addPingHandler(_converse.pong); _converse.connection.ping.addPingHandler(_converse.pong);
}; };
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
// Copyright (c) 2012-2017, Jan-Carel Brand <jc@opkode.com> // Copyright (c) 2012-2017, Jan-Carel Brand <jc@opkode.com>
// Licensed under the Mozilla Public License (MPLv2) // Licensed under the Mozilla Public License (MPLv2)
// //
/*global define, escape, locales, Jed */ /*global define, escape, locales, window */
(function (root, factory) { (function (root, factory) {
define([ define([
"sizzle", "sizzle",
...@@ -86,8 +86,11 @@ ...@@ -86,8 +86,11 @@
// Translation machinery // Translation machinery
// --------------------- // ---------------------
u.__ = function (str) { u.__ = function (str) {
if (_.isUndefined(window.Jed)) {
return str;
}
if (!u.isConverseLocale(this.locale) || this.locale === 'en') { if (!u.isConverseLocale(this.locale) || this.locale === 'en') {
return Jed.sprintf.apply(Jed, arguments); return Jed.sprintf.apply(window.Jed, arguments);
} }
if (typeof this.jed === "undefined") { if (typeof this.jed === "undefined") {
this.jed = new Jed(window.JSON.parse(locales[this.locale])); this.jed = new Jed(window.JSON.parse(locales[this.locale]));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment