Fixes broken translation after i18next-client update to 1.8.0.

This commit is contained in:
paweldomas 2015-03-17 09:24:42 +01:00
parent 0848283f6d
commit f3274ea42e
3 changed files with 29 additions and 82 deletions

View File

@ -19,7 +19,7 @@
<script src="libs/popover.js?v=1"></script><!-- bootstrap tooltip lib --> <script src="libs/popover.js?v=1"></script><!-- bootstrap tooltip lib -->
<script src="libs/toastr.js?v=1"></script><!-- notifications lib --> <script src="libs/toastr.js?v=1"></script><!-- notifications lib -->
<script src="interface_config.js?v=5"></script> <script src="interface_config.js?v=5"></script>
<script src="libs/app.bundle.js?v=37"></script> <script src="libs/app.bundle.js?v=38"></script>
<script src="analytics.js?v=1"></script><!-- google analytics plugin --> <script src="analytics.js?v=1"></script><!-- google analytics plugin -->
<link rel="stylesheet" href="css/font.css?v=6"/> <link rel="stylesheet" href="css/font.css?v=6"/>
<link rel="stylesheet" href="css/toastr.css?v=1"> <link rel="stylesheet" href="css/toastr.css?v=1">

View File

@ -17411,11 +17411,11 @@ var XMPP = {
module.exports = XMPP; module.exports = XMPP;
},{"../../service/RTC/StreamEventTypes":92,"../../service/UI/UIEvents":93,"../../service/xmpp/XMPPEvents":98,"./SDP":50,"./moderator":54,"./recording":55,"./strophe.emuc":56,"./strophe.jingle":57,"./strophe.logger":58,"./strophe.moderate":59,"./strophe.rayo":60,"./strophe.util":61,"events":1,"pako":64}],63:[function(require,module,exports){ },{"../../service/RTC/StreamEventTypes":92,"../../service/UI/UIEvents":93,"../../service/xmpp/XMPPEvents":98,"./SDP":50,"./moderator":54,"./recording":55,"./strophe.emuc":56,"./strophe.jingle":57,"./strophe.logger":58,"./strophe.moderate":59,"./strophe.rayo":60,"./strophe.util":61,"events":1,"pako":64}],63:[function(require,module,exports){
// i18next, v1.8.0 // i18next, v1.7.7
// Copyright (c)2015 Jan Mühlemann (jamuhl). // Copyright (c)2014 Jan Mühlemann (jamuhl).
// Distributed under MIT license // Distributed under MIT license
// http://i18next.com // http://i18next.com
(function(root) { (function() {
// add indexOf to non ECMA-262 standard compliant browsers // add indexOf to non ECMA-262 standard compliant browsers
if (!Array.prototype.indexOf) { if (!Array.prototype.indexOf) {
@ -17489,7 +17489,8 @@ module.exports = XMPP;
} }
} }
var $ = root.jQuery || root.Zepto var root = this
, $ = root.jQuery || root.Zepto
, i18n = {} , i18n = {}
, resStore = {} , resStore = {}
, currentLng , currentLng
@ -17504,6 +17505,16 @@ module.exports = XMPP;
// If we're not in CommonJS, add `i18n` to the // If we're not in CommonJS, add `i18n` to the
// global object or to jquery. // global object or to jquery.
if (typeof module !== 'undefined' && module.exports) { if (typeof module !== 'undefined' && module.exports) {
if (!$) {
try {
$ = require('jquery');
} catch(e) {
// just ignore
}
}
if ($) {
$.i18n = $.i18n || i18n;
}
module.exports = i18n; module.exports = i18n;
} else { } else {
if ($) { if ($) {
@ -17549,7 +17560,7 @@ module.exports = XMPP;
var todo = lngs.length; var todo = lngs.length;
f.each(lngs, function(key, lng) { f.each(lngs, function(key, lng) {
var local = f.localStorage.getItem('res_' + lng); var local = window.localStorage.getItem('res_' + lng);
if (local) { if (local) {
local = JSON.parse(local); local = JSON.parse(local);
@ -18269,16 +18280,6 @@ module.exports = XMPP;
f.log('failed to set value for key "' + key + '" to localStorage.'); f.log('failed to set value for key "' + key + '" to localStorage.');
} }
} }
},
getItem: function(key, value) {
if (window.localStorage) {
try {
return window.localStorage.getItem(key, value);
} catch (e) {
f.log('failed to get value for key "' + key + '" from localStorage.');
return undefined;
}
}
} }
} }
}; };
@ -18412,9 +18413,6 @@ module.exports = XMPP;
} else { } else {
f.extend(resStore[lng][ns], resources); f.extend(resStore[lng][ns], resources);
} }
if (o.useLocalStorage) {
sync._storeLocal(resStore);
}
} }
function hasResourceBundle(lng, ns) { function hasResourceBundle(lng, ns) {
@ -18435,15 +18433,6 @@ module.exports = XMPP;
return hasValues; return hasValues;
} }
function getResourceBundle(lng, ns) {
if (typeof ns !== 'string') {
ns = o.ns.defaultNs;
}
resStore[lng] = resStore[lng] || {};
return f.extend({}, resStore[lng][ns]);
}
function removeResourceBundle(lng, ns) { function removeResourceBundle(lng, ns) {
if (typeof ns !== 'string') { if (typeof ns !== 'string') {
ns = o.ns.defaultNs; ns = o.ns.defaultNs;
@ -18451,9 +18440,6 @@ module.exports = XMPP;
resStore[lng] = resStore[lng] || {}; resStore[lng] = resStore[lng] || {};
resStore[lng][ns] = {}; resStore[lng][ns] = {};
if (o.useLocalStorage) {
sync._storeLocal(resStore);
}
} }
function addResource(lng, ns, key, value) { function addResource(lng, ns, key, value) {
@ -18483,9 +18469,6 @@ module.exports = XMPP;
} }
x++; x++;
} }
if (o.useLocalStorage) {
sync._storeLocal(resStore);
}
} }
function addResources(lng, ns, resources) { function addResources(lng, ns, resources) {
@ -18827,10 +18810,6 @@ module.exports = XMPP;
if (potentialKeys === undefined || potentialKeys === null || potentialKeys === '') return ''; if (potentialKeys === undefined || potentialKeys === null || potentialKeys === '') return '';
if (typeof potentialKeys === 'number') {
potentialKeys = String(potentialKeys);
}
if (typeof potentialKeys === 'string') { if (typeof potentialKeys === 'string') {
potentialKeys = [potentialKeys]; potentialKeys = [potentialKeys];
} }
@ -18867,27 +18846,11 @@ module.exports = XMPP;
} }
} }
var postProcessorsToApply; var postProcessor = options.postProcess || o.postProcess;
if (typeof o.postProcess === 'string' && o.postProcess !== '') { if (found !== undefined && postProcessor) {
postProcessorsToApply = [o.postProcess]; if (postProcessors[postProcessor]) {
} else if (typeof o.postProcess === 'array' || typeof o.postProcess === 'object') { found = postProcessors[postProcessor](found, key, options);
postProcessorsToApply = o.postProcess; }
} else {
postProcessorsToApply = [];
}
if (typeof options.postProcess === 'string' && options.postProcess !== '') {
postProcessorsToApply = postProcessorsToApply.concat([options.postProcess]);
} else if (typeof options.postProcess === 'array' || typeof options.postProcess === 'object') {
postProcessorsToApply = postProcessorsToApply.concat(options.postProcess);
}
if (found !== undefined && postProcessorsToApply.length) {
postProcessorsToApply.forEach(function(postProcessor) {
if (postProcessors[postProcessor]) {
found = postProcessors[postProcessor](found, key, options);
}
});
} }
// process notFound if function exists // process notFound if function exists
@ -18904,13 +18867,9 @@ module.exports = XMPP;
notFound = applyReplacement(notFound, options); notFound = applyReplacement(notFound, options);
notFound = applyReuse(notFound, options); notFound = applyReuse(notFound, options);
if (postProcessorsToApply.length) { if (postProcessor && postProcessors[postProcessor]) {
var val = _getDefaultValue(key, options); var val = _getDefaultValue(key, options);
postProcessorsToApply.forEach(function(postProcessor) { found = postProcessors[postProcessor](val, key, options);
if (postProcessors[postProcessor]) {
found = postProcessors[postProcessor](val, key, options);
}
});
} }
} }
@ -18968,7 +18927,6 @@ module.exports = XMPP;
if (needsPlural(options, lngs[0])) { if (needsPlural(options, lngs[0])) {
optionWithoutCount = f.extend({ lngs: [lngs[0]]}, options); optionWithoutCount = f.extend({ lngs: [lngs[0]]}, options);
delete optionWithoutCount.count; delete optionWithoutCount.count;
optionWithoutCount._origLng = optionWithoutCount._origLng || optionWithoutCount.lng || lngs[0];
delete optionWithoutCount.lng; delete optionWithoutCount.lng;
optionWithoutCount.defaultValue = o.pluralNotFound; optionWithoutCount.defaultValue = o.pluralNotFound;
@ -18998,21 +18956,12 @@ module.exports = XMPP;
var clone = lngs.slice(); var clone = lngs.slice();
clone.shift(); clone.shift();
options = f.extend(options, { lngs: clone }); options = f.extend(options, { lngs: clone });
options._origLng = optionWithoutCount._origLng;
delete options.lng; delete options.lng;
// retry with fallbacks // retry with fallbacks
translated = translate(ns + o.nsseparator + key, options); translated = translate(ns + o.nsseparator + key, options);
if (translated != o.pluralNotFound) return translated; if (translated != o.pluralNotFound) return translated;
} else { } else {
optionWithoutCount.lng = optionWithoutCount._origLng; return translated;
delete optionWithoutCount._origLng;
translated = translate(ns + o.nsseparator + key, optionWithoutCount);
return applyReplacement(translated, {
count: options.count,
interpolationPrefix: options.interpolationPrefix,
interpolationSuffix: options.interpolationSuffix
});
} }
} }
@ -19133,7 +19082,7 @@ module.exports = XMPP;
// get from localStorage // get from localStorage
if (o.detectLngFromLocalStorage && typeof window !== 'undefined' && window.localStorage) { if (o.detectLngFromLocalStorage && typeof window !== 'undefined' && window.localStorage) {
userLngChoices.push(f.localStorage.getItem('i18next_lng')); userLngChoices.push(window.localStorage.getItem('i18next_lng'));
} }
// get from navigator // get from navigator
@ -19566,7 +19515,6 @@ module.exports = XMPP;
i18n.preload = preload; i18n.preload = preload;
i18n.addResourceBundle = addResourceBundle; i18n.addResourceBundle = addResourceBundle;
i18n.hasResourceBundle = hasResourceBundle; i18n.hasResourceBundle = hasResourceBundle;
i18n.getResourceBundle = getResourceBundle;
i18n.addResource = addResource; i18n.addResource = addResource;
i18n.addResources = addResources; i18n.addResources = addResources;
i18n.removeResourceBundle = removeResourceBundle; i18n.removeResourceBundle = removeResourceBundle;
@ -19582,11 +19530,10 @@ module.exports = XMPP;
i18n.functions = f; i18n.functions = f;
i18n.lng = lng; i18n.lng = lng;
i18n.addPostProcessor = addPostProcessor; i18n.addPostProcessor = addPostProcessor;
i18n.applyReplacement = f.applyReplacement;
i18n.options = o; i18n.options = o;
})(typeof exports === 'undefined' ? window : exports); })();
},{}],64:[function(require,module,exports){ },{"jquery":"jquery"}],64:[function(require,module,exports){
// Top level file is just a mixin of submodules & constants // Top level file is just a mixin of submodules & constants
'use strict'; 'use strict';

View File

@ -17,7 +17,7 @@
"dependencies": { "dependencies": {
"events": "*", "events": "*",
"pako": "*", "pako": "*",
"i18next-client": "*", "i18next-client": "1.7.7",
"sdp-interop": "jitsi/sdp-interop#f65fedfe57a" "sdp-interop": "jitsi/sdp-interop#f65fedfe57a"
}, },
"devDependencies": { "devDependencies": {