Bladeren bron

Fixes broken translation after i18next-client update to 1.8.0.

j8
paweldomas 10 jaren geleden
bovenliggende
commit
f3274ea42e
3 gewijzigde bestanden met toevoegingen van 29 en 82 verwijderingen
  1. 1
    1
      index.html
  2. 27
    80
      libs/app.bundle.js
  3. 1
    1
      package.json

+ 1
- 1
index.html Bestand weergeven

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

+ 27
- 80
libs/app.bundle.js Bestand weergeven

17411
 module.exports = XMPP;
17411
 module.exports = XMPP;
17412
 
17412
 
17413
 },{"../../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){
17413
 },{"../../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){
17414
-// i18next, v1.8.0
17415
-// Copyright (c)2015 Jan Mühlemann (jamuhl).
17414
+// i18next, v1.7.7
17415
+// Copyright (c)2014 Jan Mühlemann (jamuhl).
17416
 // Distributed under MIT license
17416
 // Distributed under MIT license
17417
 // http://i18next.com
17417
 // http://i18next.com
17418
-(function(root) {
17418
+(function() {
17419
 
17419
 
17420
     // add indexOf to non ECMA-262 standard compliant browsers
17420
     // add indexOf to non ECMA-262 standard compliant browsers
17421
     if (!Array.prototype.indexOf) {
17421
     if (!Array.prototype.indexOf) {
17489
         }
17489
         }
17490
     }
17490
     }
17491
 
17491
 
17492
-    var $ = root.jQuery || root.Zepto
17492
+    var root = this
17493
+      , $ = root.jQuery || root.Zepto
17493
       , i18n = {}
17494
       , i18n = {}
17494
       , resStore = {}
17495
       , resStore = {}
17495
       , currentLng
17496
       , currentLng
17504
     // If we're not in CommonJS, add `i18n` to the
17505
     // If we're not in CommonJS, add `i18n` to the
17505
     // global object or to jquery.
17506
     // global object or to jquery.
17506
     if (typeof module !== 'undefined' && module.exports) {
17507
     if (typeof module !== 'undefined' && module.exports) {
17508
+        if (!$) {
17509
+          try {
17510
+            $ = require('jquery');
17511
+          } catch(e) {
17512
+            // just ignore
17513
+          }
17514
+        }
17515
+        if ($) {
17516
+            $.i18n = $.i18n || i18n;
17517
+        }
17507
         module.exports = i18n;
17518
         module.exports = i18n;
17508
     } else {
17519
     } else {
17509
         if ($) {
17520
         if ($) {
17549
                 var todo = lngs.length;
17560
                 var todo = lngs.length;
17550
     
17561
     
17551
                 f.each(lngs, function(key, lng) {
17562
                 f.each(lngs, function(key, lng) {
17552
-                    var local = f.localStorage.getItem('res_' + lng);
17563
+                    var local = window.localStorage.getItem('res_' + lng);
17553
     
17564
     
17554
                     if (local) {
17565
                     if (local) {
17555
                         local = JSON.parse(local);
17566
                         local = JSON.parse(local);
18269
                         f.log('failed to set value for key "' + key + '" to localStorage.');
18280
                         f.log('failed to set value for key "' + key + '" to localStorage.');
18270
                     }
18281
                     }
18271
                 }
18282
                 }
18272
-            },
18273
-            getItem: function(key, value) {
18274
-                if (window.localStorage) {
18275
-                    try {
18276
-                        return window.localStorage.getItem(key, value);
18277
-                    } catch (e) {
18278
-                        f.log('failed to get value for key "' + key + '" from localStorage.');
18279
-                        return undefined;
18280
-                    }
18281
-                }
18282
             }
18283
             }
18283
         }
18284
         }
18284
     };
18285
     };
18412
         } else {
18413
         } else {
18413
             f.extend(resStore[lng][ns], resources);
18414
             f.extend(resStore[lng][ns], resources);
18414
         }
18415
         }
18415
-        if (o.useLocalStorage) {
18416
-            sync._storeLocal(resStore);
18417
-        }
18418
     }
18416
     }
18419
     
18417
     
18420
     function hasResourceBundle(lng, ns) {
18418
     function hasResourceBundle(lng, ns) {
18435
         return hasValues;
18433
         return hasValues;
18436
     }
18434
     }
18437
     
18435
     
18438
-    function getResourceBundle(lng, ns) {
18439
-        if (typeof ns !== 'string') {
18440
-            ns = o.ns.defaultNs;
18441
-        }
18442
-    
18443
-        resStore[lng] = resStore[lng] || {};
18444
-        return f.extend({}, resStore[lng][ns]);
18445
-    }
18446
-    
18447
     function removeResourceBundle(lng, ns) {
18436
     function removeResourceBundle(lng, ns) {
18448
         if (typeof ns !== 'string') {
18437
         if (typeof ns !== 'string') {
18449
             ns = o.ns.defaultNs;
18438
             ns = o.ns.defaultNs;
18451
     
18440
     
18452
         resStore[lng] = resStore[lng] || {};
18441
         resStore[lng] = resStore[lng] || {};
18453
         resStore[lng][ns] = {};
18442
         resStore[lng][ns] = {};
18454
-        if (o.useLocalStorage) {
18455
-            sync._storeLocal(resStore);
18456
-        }
18457
     }
18443
     }
18458
     
18444
     
18459
     function addResource(lng, ns, key, value) {
18445
     function addResource(lng, ns, key, value) {
18483
             }
18469
             }
18484
             x++;
18470
             x++;
18485
         }
18471
         }
18486
-        if (o.useLocalStorage) {
18487
-            sync._storeLocal(resStore);
18488
-        }
18489
     }
18472
     }
18490
     
18473
     
18491
     function addResources(lng, ns, resources) {
18474
     function addResources(lng, ns, resources) {
18827
     
18810
     
18828
         if (potentialKeys === undefined || potentialKeys === null || potentialKeys === '') return '';
18811
         if (potentialKeys === undefined || potentialKeys === null || potentialKeys === '') return '';
18829
     
18812
     
18830
-        if (typeof potentialKeys === 'number') {
18831
-            potentialKeys = String(potentialKeys);
18832
-        }
18833
-    
18834
         if (typeof potentialKeys === 'string') {
18813
         if (typeof potentialKeys === 'string') {
18835
             potentialKeys = [potentialKeys];
18814
             potentialKeys = [potentialKeys];
18836
         }
18815
         }
18867
             }
18846
             }
18868
         }
18847
         }
18869
     
18848
     
18870
-        var postProcessorsToApply;
18871
-        if (typeof o.postProcess === 'string' && o.postProcess !== '') {
18872
-            postProcessorsToApply = [o.postProcess];
18873
-        } else if (typeof o.postProcess === 'array' || typeof o.postProcess === 'object') {
18874
-            postProcessorsToApply = o.postProcess;
18875
-        } else {
18876
-            postProcessorsToApply = [];
18877
-        }
18878
-    
18879
-        if (typeof options.postProcess === 'string' && options.postProcess !== '') {
18880
-            postProcessorsToApply = postProcessorsToApply.concat([options.postProcess]);
18881
-        } else if (typeof options.postProcess === 'array' || typeof options.postProcess === 'object') {
18882
-            postProcessorsToApply = postProcessorsToApply.concat(options.postProcess);
18883
-        }
18884
-    
18885
-        if (found !== undefined && postProcessorsToApply.length) {
18886
-            postProcessorsToApply.forEach(function(postProcessor) {
18887
-                if (postProcessors[postProcessor]) {
18888
-                    found = postProcessors[postProcessor](found, key, options);
18889
-                }
18890
-            });
18849
+        var postProcessor = options.postProcess || o.postProcess;
18850
+        if (found !== undefined && postProcessor) {
18851
+            if (postProcessors[postProcessor]) {
18852
+                found = postProcessors[postProcessor](found, key, options);
18853
+            }
18891
         }
18854
         }
18892
     
18855
     
18893
         // process notFound if function exists
18856
         // process notFound if function exists
18904
             notFound = applyReplacement(notFound, options);
18867
             notFound = applyReplacement(notFound, options);
18905
             notFound = applyReuse(notFound, options);
18868
             notFound = applyReuse(notFound, options);
18906
     
18869
     
18907
-            if (postProcessorsToApply.length) {
18870
+            if (postProcessor && postProcessors[postProcessor]) {
18908
                 var val = _getDefaultValue(key, options);
18871
                 var val = _getDefaultValue(key, options);
18909
-                postProcessorsToApply.forEach(function(postProcessor) {
18910
-                    if (postProcessors[postProcessor]) {
18911
-                        found = postProcessors[postProcessor](val, key, options);
18912
-                    }
18913
-                });
18872
+                found = postProcessors[postProcessor](val, key, options);
18914
             }
18873
             }
18915
         }
18874
         }
18916
     
18875
     
18968
         if (needsPlural(options, lngs[0])) {
18927
         if (needsPlural(options, lngs[0])) {
18969
             optionWithoutCount = f.extend({ lngs: [lngs[0]]}, options);
18928
             optionWithoutCount = f.extend({ lngs: [lngs[0]]}, options);
18970
             delete optionWithoutCount.count;
18929
             delete optionWithoutCount.count;
18971
-            optionWithoutCount._origLng = optionWithoutCount._origLng || optionWithoutCount.lng || lngs[0];
18972
             delete optionWithoutCount.lng;
18930
             delete optionWithoutCount.lng;
18973
             optionWithoutCount.defaultValue = o.pluralNotFound;
18931
             optionWithoutCount.defaultValue = o.pluralNotFound;
18974
     
18932
     
18998
                 var clone = lngs.slice();
18956
                 var clone = lngs.slice();
18999
                 clone.shift();
18957
                 clone.shift();
19000
                 options = f.extend(options, { lngs: clone });
18958
                 options = f.extend(options, { lngs: clone });
19001
-                options._origLng = optionWithoutCount._origLng;
19002
                 delete options.lng;
18959
                 delete options.lng;
19003
                 // retry with fallbacks
18960
                 // retry with fallbacks
19004
                 translated = translate(ns + o.nsseparator + key, options);
18961
                 translated = translate(ns + o.nsseparator + key, options);
19005
                 if (translated != o.pluralNotFound) return translated;
18962
                 if (translated != o.pluralNotFound) return translated;
19006
             } else {
18963
             } else {
19007
-                optionWithoutCount.lng = optionWithoutCount._origLng;
19008
-                delete optionWithoutCount._origLng;
19009
-                translated = translate(ns + o.nsseparator + key, optionWithoutCount);
19010
-                
19011
-                return applyReplacement(translated, {
19012
-                    count: options.count,
19013
-                    interpolationPrefix: options.interpolationPrefix,
19014
-                    interpolationSuffix: options.interpolationSuffix
19015
-                });
18964
+                return translated;
19016
             }
18965
             }
19017
         }
18966
         }
19018
     
18967
     
19133
     
19082
     
19134
         // get from localStorage
19083
         // get from localStorage
19135
         if (o.detectLngFromLocalStorage && typeof window !== 'undefined' && window.localStorage) {
19084
         if (o.detectLngFromLocalStorage && typeof window !== 'undefined' && window.localStorage) {
19136
-            userLngChoices.push(f.localStorage.getItem('i18next_lng'));
19085
+            userLngChoices.push(window.localStorage.getItem('i18next_lng'));
19137
         }
19086
         }
19138
     
19087
     
19139
         // get from navigator
19088
         // get from navigator
19566
     i18n.preload = preload;
19515
     i18n.preload = preload;
19567
     i18n.addResourceBundle = addResourceBundle;
19516
     i18n.addResourceBundle = addResourceBundle;
19568
     i18n.hasResourceBundle = hasResourceBundle;
19517
     i18n.hasResourceBundle = hasResourceBundle;
19569
-    i18n.getResourceBundle = getResourceBundle;
19570
     i18n.addResource = addResource;
19518
     i18n.addResource = addResource;
19571
     i18n.addResources = addResources;
19519
     i18n.addResources = addResources;
19572
     i18n.removeResourceBundle = removeResourceBundle;
19520
     i18n.removeResourceBundle = removeResourceBundle;
19582
     i18n.functions = f;
19530
     i18n.functions = f;
19583
     i18n.lng = lng;
19531
     i18n.lng = lng;
19584
     i18n.addPostProcessor = addPostProcessor;
19532
     i18n.addPostProcessor = addPostProcessor;
19585
-    i18n.applyReplacement = f.applyReplacement;
19586
     i18n.options = o;
19533
     i18n.options = o;
19587
 
19534
 
19588
-})(typeof exports === 'undefined' ? window : exports);
19589
-},{}],64:[function(require,module,exports){
19535
+})();
19536
+},{"jquery":"jquery"}],64:[function(require,module,exports){
19590
 // Top level file is just a mixin of submodules & constants
19537
 // Top level file is just a mixin of submodules & constants
19591
 'use strict';
19538
 'use strict';
19592
 
19539
 

+ 1
- 1
package.json Bestand weergeven

17
   "dependencies": {
17
   "dependencies": {
18
       "events": "*",
18
       "events": "*",
19
       "pako": "*",
19
       "pako": "*",
20
-      "i18next-client": "*",
20
+      "i18next-client": "1.7.7",
21
       "sdp-interop": "jitsi/sdp-interop#f65fedfe57a"
21
       "sdp-interop": "jitsi/sdp-interop#f65fedfe57a"
22
   },
22
   },
23
   "devDependencies": {
23
   "devDependencies": {

Laden…
Annuleren
Opslaan