Commit 35a1693a authored by JC Brand's avatar JC Brand

Use es2015 module imports in i18n.js

parent a5fdbb0e
...@@ -62373,7 +62373,6 @@ __webpack_require__.r(__webpack_exports__); ...@@ -62373,7 +62373,6 @@ __webpack_require__.r(__webpack_exports__);
/* harmony import */ var _lodash_fp__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./lodash.fp */ "./src/headless/lodash.fp.js"); /* harmony import */ var _lodash_fp__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./lodash.fp */ "./src/headless/lodash.fp.js");
/* harmony import */ var _lodash_fp__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_lodash_fp__WEBPACK_IMPORTED_MODULE_5__); /* harmony import */ var _lodash_fp__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_lodash_fp__WEBPACK_IMPORTED_MODULE_5__);
/* harmony import */ var _i18n__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./i18n */ "./src/headless/i18n.js"); /* harmony import */ var _i18n__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./i18n */ "./src/headless/i18n.js");
/* harmony import */ var _i18n__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_i18n__WEBPACK_IMPORTED_MODULE_6__);
/* harmony import */ var moment__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! moment */ "./node_modules/moment/moment.js"); /* harmony import */ var moment__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! moment */ "./node_modules/moment/moment.js");
/* harmony import */ var moment__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(moment__WEBPACK_IMPORTED_MODULE_7__); /* harmony import */ var moment__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(moment__WEBPACK_IMPORTED_MODULE_7__);
/* harmony import */ var pluggable_js_dist_pluggable__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! pluggable.js/dist/pluggable */ "./node_modules/pluggable.js/dist/pluggable.js"); /* harmony import */ var pluggable_js_dist_pluggable__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! pluggable.js/dist/pluggable */ "./node_modules/pluggable.js/dist/pluggable.js");
...@@ -62650,11 +62649,11 @@ _converse.__ = function (str) { ...@@ -62650,11 +62649,11 @@ _converse.__ = function (str) {
* Parameters: * Parameters:
* (String) str - The string to translate. * (String) str - The string to translate.
*/ */
if (_lodash_noconflict__WEBPACK_IMPORTED_MODULE_4___default.a.isUndefined(_i18n__WEBPACK_IMPORTED_MODULE_6___default.a)) { if (_lodash_noconflict__WEBPACK_IMPORTED_MODULE_4___default.a.isUndefined(_i18n__WEBPACK_IMPORTED_MODULE_6__["default"])) {
return str; return str;
} }
return _i18n__WEBPACK_IMPORTED_MODULE_6___default.a.translate.apply(_i18n__WEBPACK_IMPORTED_MODULE_6___default.a, arguments); return _i18n__WEBPACK_IMPORTED_MODULE_6__["default"].translate.apply(_i18n__WEBPACK_IMPORTED_MODULE_6__["default"], arguments);
}; };
const __ = _converse.__; const __ = _converse.__;
...@@ -62743,8 +62742,8 @@ _converse.initialize = function (settings, callback) { ...@@ -62743,8 +62742,8 @@ _converse.initialize = function (settings, callback) {
/* Localisation */ /* Localisation */
if (!_lodash_noconflict__WEBPACK_IMPORTED_MODULE_4___default.a.isUndefined(_i18n__WEBPACK_IMPORTED_MODULE_6___default.a)) { if (!_lodash_noconflict__WEBPACK_IMPORTED_MODULE_4___default.a.isUndefined(_i18n__WEBPACK_IMPORTED_MODULE_6__["default"])) {
_i18n__WEBPACK_IMPORTED_MODULE_6___default.a.setLocales(settings.i18n, _converse); _i18n__WEBPACK_IMPORTED_MODULE_6__["default"].setLocales(settings.i18n, _converse);
} else { } else {
_converse.locale = 'en'; _converse.locale = 'en';
} // Module-level variables } // Module-level variables
...@@ -63680,10 +63679,10 @@ _converse.initialize = function (settings, callback) { ...@@ -63680,10 +63679,10 @@ _converse.initialize = function (settings, callback) {
if (!_lodash_noconflict__WEBPACK_IMPORTED_MODULE_4___default.a.isUndefined(_converse.connection) && _converse.connection.service === 'jasmine tests') { if (!_lodash_noconflict__WEBPACK_IMPORTED_MODULE_4___default.a.isUndefined(_converse.connection) && _converse.connection.service === 'jasmine tests') {
finishInitialization(); finishInitialization();
return _converse; return _converse;
} else if (_lodash_noconflict__WEBPACK_IMPORTED_MODULE_4___default.a.isUndefined(_i18n__WEBPACK_IMPORTED_MODULE_6___default.a)) { } else if (_lodash_noconflict__WEBPACK_IMPORTED_MODULE_4___default.a.isUndefined(_i18n__WEBPACK_IMPORTED_MODULE_6__["default"])) {
finishInitialization(); finishInitialization();
} else { } else {
_i18n__WEBPACK_IMPORTED_MODULE_6___default.a.fetchTranslations(_converse.locale, _converse.locales, _converse_headless_utils_core__WEBPACK_IMPORTED_MODULE_11__["default"].interpolate(_converse.locales_url, { _i18n__WEBPACK_IMPORTED_MODULE_6__["default"].fetchTranslations(_converse.locale, _converse.locales, _converse_headless_utils_core__WEBPACK_IMPORTED_MODULE_11__["default"].interpolate(_converse.locales_url, {
'locale': _converse.locale 'locale': _converse.locale
})).catch(e => _converse.log(e.message, strophe_js__WEBPACK_IMPORTED_MODULE_0__["Strophe"].LogLevel.FATAL)).then(finishInitialization).catch(_lodash_noconflict__WEBPACK_IMPORTED_MODULE_4___default.a.partial(_converse.log, _lodash_noconflict__WEBPACK_IMPORTED_MODULE_4___default.a, strophe_js__WEBPACK_IMPORTED_MODULE_0__["Strophe"].LogLevel.FATAL)); })).catch(e => _converse.log(e.message, strophe_js__WEBPACK_IMPORTED_MODULE_0__["Strophe"].LogLevel.FATAL)).then(finishInitialization).catch(_lodash_noconflict__WEBPACK_IMPORTED_MODULE_4___default.a.partial(_converse.log, _lodash_noconflict__WEBPACK_IMPORTED_MODULE_4___default.a, strophe_js__WEBPACK_IMPORTED_MODULE_0__["Strophe"].LogLevel.FATAL));
} }
...@@ -68910,10 +68909,70 @@ _converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins.add('converse-vca ...@@ -68910,10 +68909,70 @@ _converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins.add('converse-vca
/*!******************************!*\ /*!******************************!*\
!*** ./src/headless/i18n.js ***! !*** ./src/headless/i18n.js ***!
\******************************/ \******************************/
/*! no static exports found */ /*! exports provided: default */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, __webpack_exports__, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;// Converse.js (A browser based XMPP chat client) "use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var moment_locale_af__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! moment/locale/af */ "./node_modules/moment/locale/af.js");
/* harmony import */ var moment_locale_af__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(moment_locale_af__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var moment_locale_ar__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! moment/locale/ar */ "./node_modules/moment/locale/ar.js");
/* harmony import */ var moment_locale_ar__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(moment_locale_ar__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var moment_locale_bg__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! moment/locale/bg */ "./node_modules/moment/locale/bg.js");
/* harmony import */ var moment_locale_bg__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(moment_locale_bg__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var moment_locale_ca__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! moment/locale/ca */ "./node_modules/moment/locale/ca.js");
/* harmony import */ var moment_locale_ca__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(moment_locale_ca__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var moment_locale_cs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! moment/locale/cs */ "./node_modules/moment/locale/cs.js");
/* harmony import */ var moment_locale_cs__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(moment_locale_cs__WEBPACK_IMPORTED_MODULE_4__);
/* harmony import */ var moment_locale_de__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! moment/locale/de */ "./node_modules/moment/locale/de.js");
/* harmony import */ var moment_locale_de__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(moment_locale_de__WEBPACK_IMPORTED_MODULE_5__);
/* harmony import */ var moment_locale_es__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! moment/locale/es */ "./node_modules/moment/locale/es.js");
/* harmony import */ var moment_locale_es__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(moment_locale_es__WEBPACK_IMPORTED_MODULE_6__);
/* harmony import */ var moment_locale_eu__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! moment/locale/eu */ "./node_modules/moment/locale/eu.js");
/* harmony import */ var moment_locale_eu__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(moment_locale_eu__WEBPACK_IMPORTED_MODULE_7__);
/* harmony import */ var moment_locale_fr__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! moment/locale/fr */ "./node_modules/moment/locale/fr.js");
/* harmony import */ var moment_locale_fr__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(moment_locale_fr__WEBPACK_IMPORTED_MODULE_8__);
/* harmony import */ var moment_locale_he__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! moment/locale/he */ "./node_modules/moment/locale/he.js");
/* harmony import */ var moment_locale_he__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(moment_locale_he__WEBPACK_IMPORTED_MODULE_9__);
/* harmony import */ var moment_locale_hi__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! moment/locale/hi */ "./node_modules/moment/locale/hi.js");
/* harmony import */ var moment_locale_hi__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(moment_locale_hi__WEBPACK_IMPORTED_MODULE_10__);
/* harmony import */ var moment_locale_hu__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! moment/locale/hu */ "./node_modules/moment/locale/hu.js");
/* harmony import */ var moment_locale_hu__WEBPACK_IMPORTED_MODULE_11___default = /*#__PURE__*/__webpack_require__.n(moment_locale_hu__WEBPACK_IMPORTED_MODULE_11__);
/* harmony import */ var moment_locale_id__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! moment/locale/id */ "./node_modules/moment/locale/id.js");
/* harmony import */ var moment_locale_id__WEBPACK_IMPORTED_MODULE_12___default = /*#__PURE__*/__webpack_require__.n(moment_locale_id__WEBPACK_IMPORTED_MODULE_12__);
/* harmony import */ var moment_locale_it__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! moment/locale/it */ "./node_modules/moment/locale/it.js");
/* harmony import */ var moment_locale_it__WEBPACK_IMPORTED_MODULE_13___default = /*#__PURE__*/__webpack_require__.n(moment_locale_it__WEBPACK_IMPORTED_MODULE_13__);
/* harmony import */ var moment_locale_ja__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! moment/locale/ja */ "./node_modules/moment/locale/ja.js");
/* harmony import */ var moment_locale_ja__WEBPACK_IMPORTED_MODULE_14___default = /*#__PURE__*/__webpack_require__.n(moment_locale_ja__WEBPACK_IMPORTED_MODULE_14__);
/* harmony import */ var moment_locale_nb__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! moment/locale/nb */ "./node_modules/moment/locale/nb.js");
/* harmony import */ var moment_locale_nb__WEBPACK_IMPORTED_MODULE_15___default = /*#__PURE__*/__webpack_require__.n(moment_locale_nb__WEBPACK_IMPORTED_MODULE_15__);
/* harmony import */ var moment_locale_nl__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! moment/locale/nl */ "./node_modules/moment/locale/nl.js");
/* harmony import */ var moment_locale_nl__WEBPACK_IMPORTED_MODULE_16___default = /*#__PURE__*/__webpack_require__.n(moment_locale_nl__WEBPACK_IMPORTED_MODULE_16__);
/* harmony import */ var moment_locale_pl__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! moment/locale/pl */ "./node_modules/moment/locale/pl.js");
/* harmony import */ var moment_locale_pl__WEBPACK_IMPORTED_MODULE_17___default = /*#__PURE__*/__webpack_require__.n(moment_locale_pl__WEBPACK_IMPORTED_MODULE_17__);
/* harmony import */ var moment_locale_pt_br__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! moment/locale/pt-br */ "./node_modules/moment/locale/pt-br.js");
/* harmony import */ var moment_locale_pt_br__WEBPACK_IMPORTED_MODULE_18___default = /*#__PURE__*/__webpack_require__.n(moment_locale_pt_br__WEBPACK_IMPORTED_MODULE_18__);
/* harmony import */ var moment_locale_ro__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! moment/locale/ro */ "./node_modules/moment/locale/ro.js");
/* harmony import */ var moment_locale_ro__WEBPACK_IMPORTED_MODULE_19___default = /*#__PURE__*/__webpack_require__.n(moment_locale_ro__WEBPACK_IMPORTED_MODULE_19__);
/* harmony import */ var moment_locale_ru__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! moment/locale/ru */ "./node_modules/moment/locale/ru.js");
/* harmony import */ var moment_locale_ru__WEBPACK_IMPORTED_MODULE_20___default = /*#__PURE__*/__webpack_require__.n(moment_locale_ru__WEBPACK_IMPORTED_MODULE_20__);
/* harmony import */ var moment_locale_tr__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! moment/locale/tr */ "./node_modules/moment/locale/tr.js");
/* harmony import */ var moment_locale_tr__WEBPACK_IMPORTED_MODULE_21___default = /*#__PURE__*/__webpack_require__.n(moment_locale_tr__WEBPACK_IMPORTED_MODULE_21__);
/* harmony import */ var moment_locale_uk__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! moment/locale/uk */ "./node_modules/moment/locale/uk.js");
/* harmony import */ var moment_locale_uk__WEBPACK_IMPORTED_MODULE_22___default = /*#__PURE__*/__webpack_require__.n(moment_locale_uk__WEBPACK_IMPORTED_MODULE_22__);
/* harmony import */ var moment_locale_zh_cn__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! moment/locale/zh-cn */ "./node_modules/moment/locale/zh-cn.js");
/* harmony import */ var moment_locale_zh_cn__WEBPACK_IMPORTED_MODULE_23___default = /*#__PURE__*/__webpack_require__.n(moment_locale_zh_cn__WEBPACK_IMPORTED_MODULE_23__);
/* harmony import */ var moment_locale_zh_tw__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! moment/locale/zh-tw */ "./node_modules/moment/locale/zh-tw.js");
/* harmony import */ var moment_locale_zh_tw__WEBPACK_IMPORTED_MODULE_24___default = /*#__PURE__*/__webpack_require__.n(moment_locale_zh_tw__WEBPACK_IMPORTED_MODULE_24__);
/* harmony import */ var jed__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(/*! jed */ "./node_modules/jed/jed.js");
/* harmony import */ var jed__WEBPACK_IMPORTED_MODULE_25___default = /*#__PURE__*/__webpack_require__.n(jed__WEBPACK_IMPORTED_MODULE_25__);
/* harmony import */ var es6_promise_dist_es6_promise_auto__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(/*! es6-promise/dist/es6-promise.auto */ "./node_modules/es6-promise/dist/es6-promise.auto.js");
/* harmony import */ var es6_promise_dist_es6_promise_auto__WEBPACK_IMPORTED_MODULE_26___default = /*#__PURE__*/__webpack_require__.n(es6_promise_dist_es6_promise_auto__WEBPACK_IMPORTED_MODULE_26__);
/* harmony import */ var _lodash_noconflict__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(/*! ./lodash.noconflict */ "./src/headless/lodash.noconflict.js");
/* harmony import */ var _lodash_noconflict__WEBPACK_IMPORTED_MODULE_27___default = /*#__PURE__*/__webpack_require__.n(_lodash_noconflict__WEBPACK_IMPORTED_MODULE_27__);
/* harmony import */ var moment__WEBPACK_IMPORTED_MODULE_28__ = __webpack_require__(/*! moment */ "./node_modules/moment/moment.js");
/* harmony import */ var moment__WEBPACK_IMPORTED_MODULE_28___default = /*#__PURE__*/__webpack_require__.n(moment__WEBPACK_IMPORTED_MODULE_28__);
// Converse.js (A browser based XMPP chat client)
// http://conversejs.org // http://conversejs.org
// //
// This is the internationalization module. // This is the internationalization module.
...@@ -68923,15 +68982,37 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ ...@@ -68923,15 +68982,37 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
// //
/*global define */ /*global define */
(function (root, factory) {
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(/*! es6-promise/dist/es6-promise.auto */ "./node_modules/es6-promise/dist/es6-promise.auto.js"), __webpack_require__(/*! jed */ "./node_modules/jed/jed.js"), __webpack_require__(/*! ./lodash.noconflict */ "./src/headless/lodash.noconflict.js"), __webpack_require__(/*! moment */ "./node_modules/moment/moment.js"), __webpack_require__(/*! moment/locale/af */ "./node_modules/moment/locale/af.js"), __webpack_require__(/*! moment/locale/ar */ "./node_modules/moment/locale/ar.js"), __webpack_require__(/*! moment/locale/bg */ "./node_modules/moment/locale/bg.js"), __webpack_require__(/*! moment/locale/ca */ "./node_modules/moment/locale/ca.js"), __webpack_require__(/*! moment/locale/cs */ "./node_modules/moment/locale/cs.js"), __webpack_require__(/*! moment/locale/de */ "./node_modules/moment/locale/de.js"), __webpack_require__(/*! moment/locale/es */ "./node_modules/moment/locale/es.js"), __webpack_require__(/*! moment/locale/eu */ "./node_modules/moment/locale/eu.js"), __webpack_require__(/*! moment/locale/fr */ "./node_modules/moment/locale/fr.js"), __webpack_require__(/*! moment/locale/he */ "./node_modules/moment/locale/he.js"), __webpack_require__(/*! moment/locale/hi */ "./node_modules/moment/locale/hi.js"), __webpack_require__(/*! moment/locale/hu */ "./node_modules/moment/locale/hu.js"), __webpack_require__(/*! moment/locale/id */ "./node_modules/moment/locale/id.js"), __webpack_require__(/*! moment/locale/it */ "./node_modules/moment/locale/it.js"), __webpack_require__(/*! moment/locale/ja */ "./node_modules/moment/locale/ja.js"), __webpack_require__(/*! moment/locale/nb */ "./node_modules/moment/locale/nb.js"), __webpack_require__(/*! moment/locale/nl */ "./node_modules/moment/locale/nl.js"), __webpack_require__(/*! moment/locale/pl */ "./node_modules/moment/locale/pl.js"), __webpack_require__(/*! moment/locale/pt-br */ "./node_modules/moment/locale/pt-br.js"), __webpack_require__(/*! moment/locale/ro */ "./node_modules/moment/locale/ro.js"), __webpack_require__(/*! moment/locale/ru */ "./node_modules/moment/locale/ru.js"), __webpack_require__(/*! moment/locale/tr */ "./node_modules/moment/locale/tr.js"), __webpack_require__(/*! moment/locale/uk */ "./node_modules/moment/locale/uk.js"), __webpack_require__(/*! moment/locale/zh-cn */ "./node_modules/moment/locale/zh-cn.js"), __webpack_require__(/*! moment/locale/zh-tw */ "./node_modules/moment/locale/zh-tw.js")], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
})(this, function (Promise, Jed, _, moment) {
'use strict';
function detectLocale(library_check) {
function detectLocale(library_check) {
/* Determine which locale is supported by the user's system as well /* Determine which locale is supported by the user's system as well
* as by the relevant library (e.g. converse.js or moment.js). * as by the relevant library (e.g. converse.js or moment.js).
* *
...@@ -68964,27 +69045,27 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ ...@@ -68964,27 +69045,27 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
} }
return locale || 'en'; return locale || 'en';
} }
function isMomentLocale(locale) { function isMomentLocale(locale) {
return _.includes(moment.locales(), locale); return _lodash_noconflict__WEBPACK_IMPORTED_MODULE_27___default.a.includes(moment__WEBPACK_IMPORTED_MODULE_28___default.a.locales(), locale);
} }
function isConverseLocale(locale, supported_locales) { function isConverseLocale(locale, supported_locales) {
return _.isString(locale) && _.includes(supported_locales, locale); return _lodash_noconflict__WEBPACK_IMPORTED_MODULE_27___default.a.isString(locale) && _lodash_noconflict__WEBPACK_IMPORTED_MODULE_27___default.a.includes(supported_locales, locale);
} }
function getLocale(preferred_locale, isSupportedByLibrary) { function getLocale(preferred_locale, isSupportedByLibrary) {
if (_.isString(preferred_locale)) { if (_lodash_noconflict__WEBPACK_IMPORTED_MODULE_27___default.a.isString(preferred_locale)) {
if (preferred_locale === 'en' || isSupportedByLibrary(preferred_locale)) { if (preferred_locale === 'en' || isSupportedByLibrary(preferred_locale)) {
return preferred_locale; return preferred_locale;
} }
} }
return detectLocale(isSupportedByLibrary) || 'en'; return detectLocale(isSupportedByLibrary) || 'en';
} }
function isLocaleAvailable(locale, available) { function isLocaleAvailable(locale, available) {
/* Check whether the locale or sub locale (e.g. en-US, en) is supported. /* Check whether the locale or sub locale (e.g. en-US, en) is supported.
* *
* Parameters: * Parameters:
...@@ -69000,18 +69081,18 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ ...@@ -69000,18 +69081,18 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
return sublocale; return sublocale;
} }
} }
} }
let jed_instance; let jed_instance;
return { /* harmony default export */ __webpack_exports__["default"] = ({
setLocales(preferred_locale, _converse) { setLocales(preferred_locale, _converse) {
_converse.locale = getLocale(preferred_locale, _.partial(isConverseLocale, _, _converse.locales)); _converse.locale = getLocale(preferred_locale, _lodash_noconflict__WEBPACK_IMPORTED_MODULE_27___default.a.partial(isConverseLocale, _lodash_noconflict__WEBPACK_IMPORTED_MODULE_27___default.a, _converse.locales));
moment.locale(getLocale(preferred_locale, isMomentLocale)); moment__WEBPACK_IMPORTED_MODULE_28___default.a.locale(getLocale(preferred_locale, isMomentLocale));
}, },
translate(str) { translate(str) {
if (_.isNil(jed_instance)) { if (_lodash_noconflict__WEBPACK_IMPORTED_MODULE_27___default.a.isNil(jed_instance)) {
return Jed.sprintf.apply(Jed, arguments); return jed__WEBPACK_IMPORTED_MODULE_25___default.a.sprintf.apply(jed__WEBPACK_IMPORTED_MODULE_25___default.a, arguments);
} }
var t = jed_instance.translate(str); var t = jed_instance.translate(str);
...@@ -69032,7 +69113,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ ...@@ -69032,7 +69113,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
* (String) locale_url: The URL from which the translations * (String) locale_url: The URL from which the translations
* should be fetched. * should be fetched.
*/ */
return new Promise((resolve, reject) => { return new es6_promise_dist_es6_promise_auto__WEBPACK_IMPORTED_MODULE_26___default.a((resolve, reject) => {
if (!isConverseLocale(locale, supported_locales) || locale === 'en') { if (!isConverseLocale(locale, supported_locales) || locale === 'en') {
return resolve(); return resolve();
} }
...@@ -69045,7 +69126,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ ...@@ -69045,7 +69126,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
if (xhr.status >= 200 && xhr.status < 400) { if (xhr.status >= 200 && xhr.status < 400) {
try { try {
const data = window.JSON.parse(xhr.responseText); const data = window.JSON.parse(xhr.responseText);
jed_instance = new Jed(data); jed_instance = new jed__WEBPACK_IMPORTED_MODULE_25___default.a(data);
resolve(); resolve();
} catch (e) { } catch (e) {
xhr.onerror(e); xhr.onerror(e);
...@@ -69064,7 +69145,6 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ ...@@ -69064,7 +69145,6 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
}); });
} }
};
}); });
/***/ }), /***/ }),
...@@ -8,42 +8,38 @@ ...@@ -8,42 +8,38 @@
// //
/*global define */ /*global define */
(function (root, factory) { import 'moment/locale/af';
define([ import 'moment/locale/ar';
"es6-promise/dist/es6-promise.auto", import 'moment/locale/bg';
"jed", import 'moment/locale/ca';
"./lodash.noconflict", import 'moment/locale/cs';
"moment", import 'moment/locale/de';
'moment/locale/af', import 'moment/locale/es';
'moment/locale/ar', import 'moment/locale/eu';
'moment/locale/bg', import 'moment/locale/fr';
'moment/locale/ca', import 'moment/locale/he';
'moment/locale/cs', import 'moment/locale/hi';
'moment/locale/de', import 'moment/locale/hu';
'moment/locale/es', import 'moment/locale/id';
'moment/locale/eu', import 'moment/locale/it';
'moment/locale/fr', import 'moment/locale/ja';
'moment/locale/he', import 'moment/locale/nb';
'moment/locale/hi', import 'moment/locale/nl';
'moment/locale/hu', import 'moment/locale/pl';
'moment/locale/id', import 'moment/locale/pt-br';
'moment/locale/it', import 'moment/locale/ro';
'moment/locale/ja', import 'moment/locale/ru';
'moment/locale/nb', import 'moment/locale/tr';
'moment/locale/nl', import 'moment/locale/uk';
'moment/locale/pl', import 'moment/locale/zh-cn';
'moment/locale/pt-br', import 'moment/locale/zh-tw';
'moment/locale/ro', import Jed from "jed";
'moment/locale/ru', import Promise from "es6-promise/dist/es6-promise.auto";
'moment/locale/tr', import _ from "./lodash.noconflict";
'moment/locale/uk', import moment from "moment";
'moment/locale/zh-cn',
'moment/locale/zh-tw'
], factory);
}(this, function (Promise, Jed, _, moment) {
'use strict';
function detectLocale (library_check) {
function detectLocale (library_check) {
/* Determine which locale is supported by the user's system as well /* Determine which locale is supported by the user's system as well
* as by the relevant library (e.g. converse.js or moment.js). * as by the relevant library (e.g. converse.js or moment.js).
* *
...@@ -70,26 +66,26 @@ ...@@ -70,26 +66,26 @@
locale = isLocaleAvailable(window.navigator.systemLanguage, library_check); locale = isLocaleAvailable(window.navigator.systemLanguage, library_check);
} }
return locale || 'en'; return locale || 'en';
} }
function isMomentLocale (locale) { function isMomentLocale (locale) {
return _.includes(moment.locales(), locale); return _.includes(moment.locales(), locale);
} }
function isConverseLocale (locale, supported_locales) { function isConverseLocale (locale, supported_locales) {
return _.isString(locale) && _.includes(supported_locales, locale); return _.isString(locale) && _.includes(supported_locales, locale);
} }
function getLocale (preferred_locale, isSupportedByLibrary) { function getLocale (preferred_locale, isSupportedByLibrary) {
if (_.isString(preferred_locale)) { if (_.isString(preferred_locale)) {
if (preferred_locale === 'en' || isSupportedByLibrary(preferred_locale)) { if (preferred_locale === 'en' || isSupportedByLibrary(preferred_locale)) {
return preferred_locale; return preferred_locale;
} }
} }
return detectLocale(isSupportedByLibrary) || 'en'; return detectLocale(isSupportedByLibrary) || 'en';
} }
function isLocaleAvailable (locale, available) { function isLocaleAvailable (locale, available) {
/* Check whether the locale or sub locale (e.g. en-US, en) is supported. /* Check whether the locale or sub locale (e.g. en-US, en) is supported.
* *
* Parameters: * Parameters:
...@@ -104,11 +100,11 @@ ...@@ -104,11 +100,11 @@
return sublocale; return sublocale;
} }
} }
} }
let jed_instance; let jed_instance;
return { export default {
setLocales (preferred_locale, _converse) { setLocales (preferred_locale, _converse) {
_converse.locale = getLocale( _converse.locale = getLocale(
...@@ -169,5 +165,4 @@ ...@@ -169,5 +165,4 @@
xhr.send(); xhr.send();
}); });
} }
}; };
}));
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