Also, moved locales.js to ./src folder. Add it as dependency to utils.js and remove it from the deps scripts
@@ -225,6 +225,7 @@
// Translation machinery
// ---------------------
+ this.i18n = settings.i18n ? settings.i18n : locales.en;
var __ = $.proxy(utils.__, this);
var ___ = utils.___;
@@ -250,7 +251,6 @@
forward_messages: false,
hide_muc_server: false,
hide_offline_users: false,
- i18n: locales.en,
jid: undefined,
keepalive: false,
message_carbons: false,
@@ -282,8 +282,6 @@
// Allow only whitelisted configuration attributes to be overwritten
_.extend(this, _.pick(settings, Object.keys(default_settings)));
- this.jed = new Jed(this.i18n);
-
if (settings.visible_toolbar_buttons) {
_.extend(
this.visible_toolbar_buttons,
@@ -17,7 +17,6 @@
</head>
<body id="page-top" data-spy="scroll" data-target=".navbar-custom">
<nav class="navbar navbar-custom navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header page-scroll">
@@ -1,12 +0,0 @@
-/*
- * This file specifies the language dependencies.
- *
- * Translations take up a lot of space and you are therefore advised to remove
- * from here any languages that you don't need.
- */
-(function (root, factory) {
- define("locales", ['jquery', 'jed',
- ], function ($, Jed, af, de, en, es, fr, he, hu, id, it, ja, nb, nl, pl, pt_BR, ru, zh) {
- });
-})(this);
@@ -56,7 +56,7 @@ require.config({
"otr": "src/otr",
// Locales paths
- "locales": "locale/locales",
+ "locales": "src/locales",
"jed": "components/jed/jed",
"af": "locale/af/LC_MESSAGES/converse.json",
"de": "locale/de/LC_MESSAGES/converse.json",
@@ -3,7 +3,6 @@ define("converse-dependencies", [
"utils",
"otr",
"moment",
- "locales",
"backbone.browserStorage",
"backbone.overview",
"jquery.browser",
@@ -2,7 +2,6 @@ define("converse-dependencies", [
"jquery",
"bootstrapJS", // XXX: Can be removed, only for https://conversejs.org
"bootstrapJS", // XXX: Only for https://conversejs.org
@@ -0,0 +1,46 @@
+/*
+ * This file specifies the language dependencies.
+ *
+ * Translations take up a lot of space and you are therefore advised to remove
+ * from here any languages that you don't need.
+ */
+(function (root, factory) {
+ define("locales", ['jquery', 'jed',
+ 'text!af',
+ 'text!de',
+ 'text!en',
+ 'text!es',
+ 'text!fr',
+ 'text!he',
+ 'text!hu',
+ 'text!id',
+ 'text!it',
+ 'text!ja',
+ 'text!nb',
+ 'text!nl',
+ 'text!pl',
+ 'text!pt_BR',
+ 'text!ru',
+ 'text!zh'
+ ], function ($, Jed) {
+ root.locales = {
+ 'af': arguments[2],
+ 'de': arguments[3],
+ 'en': arguments[4],
+ 'es': arguments[5],
+ 'fr': arguments[6],
+ 'he': arguments[7],
+ 'hu': arguments[8],
+ 'id': arguments[9],
+ 'it': arguments[10],
+ 'ja': arguments[11],
+ 'nb': arguments[12],
+ 'nl': arguments[13],
+ 'pl': arguments[14],
+ 'pt-br': arguments[15],
+ 'ru': arguments[16],
+ 'zh': arguments[17]
+ };
+ return root.locales;
+ });
+})(this);
@@ -4,7 +4,7 @@
} else {
root.utils = factory(jQuery, templates);
}
-}(this, function ($, templates) {
+}(this, function ($, templates, locales) {
"use strict";
var XFORM_TYPE_MAP = {
@@ -58,6 +58,9 @@
if (typeof this.i18n === "undefined") {
this.i18n = locales.en;
+ if (typeof this.i18n === "string") {
+ this.i18n = $.parseJSON(this.i18n);
+ }
if (typeof this.jed === "undefined") {
this.jed = new Jed(this.i18n);