After some deepening in the source code, I created a solution that works, but certainly needs improvement in the long run.
In the definition of i18n.addjQueryFunct() add this to access resStore (translation storage variable):
$.i18n._getResStore = _getResStore; $.i18n._writeResStore = _writeResStore; function _getResStore() { return resStore; } function _writeResStore(r) { resStore = r; }
If you want to load the extra namespace, just do something like this:
// define options, run $.i18n.init, etc... // suppose ns = "namespace_foobar_new" options.ns.namespaces.push(ns); $.i18n.sync._fetchOne(lang, ns, $.extend({}, $.i18n.options, options), function(err, data) { store = {}; store[lang] = {}; store[lang][ns] = data; newResStore = $.extend(true, {}, $.i18n._getResStore(), store); $.i18n._writeResStore(newResStore); });
Phew
source share