Browse Source

Fixes translation of plurals.

master
hristoterezov 10 years ago
parent
commit
6f12446c99
5 changed files with 49 additions and 57 deletions
  1. 1
    1
      index.html
  2. 4
    4
      lang/main.json
  3. 22
    26
      libs/app.bundle.js
  4. 21
    25
      modules/UI/videolayout/ConnectionIndicator.js
  5. 1
    1
      modules/translation/translation.js

+ 1
- 1
index.html View File

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

+ 4
- 4
lang/main.json View File

@@ -95,14 +95,14 @@
95 95
         "less": "Show less",
96 96
         "more": "Show more",
97 97
         "address": "Address:",
98
-        "remoteports": "Remote ports:",
99
-        "localports": "Local ports:",
98
+        "remoteport_plural": "Remote ports:",
99
+        "localport_plural": "Local ports:",
100 100
         "remoteport": "Remote port:",
101 101
         "localport": "Local port:",
102 102
         "localaddress": "Local address: ",
103
-        "localaddresses": "Local addresses: ",
103
+        "localaddress_plural": "Local addresses: ",
104 104
         "remoteaddress": "Remote address: ",
105
-        "remoteaddresses": "Remote addresses: ",
105
+        "remoteaddress_plural": "Remote addresses: ",
106 106
         "transport": "Transport: ",
107 107
         "bandwidth": "Estimated bandwidth:",
108 108
         "na": "Come back here for connection information once the conference starts"

+ 22
- 26
libs/app.bundle.js View File

@@ -6039,47 +6039,43 @@ ConnectionIndicator.prototype.generateText = function () {
6039 6039
 
6040 6040
             }
6041 6041
 
6042
-            var local_address_key = "connectionindicator." +
6043
-                (data.localIP.length > 1? "localaddresses" : "localaddress");
6044
-            var remote_address_key = "connectionindicator." +
6045
-                (data.remoteIP.length > 1? "remoteaddresses" : "remoteaddress");
6042
+            var local_address_key = "connectionindicator.localaddress";
6043
+            var remote_address_key = "connectionindicator.remoteaddress";
6046 6044
             var localTransport =
6047 6045
                 "<tr><td><span class='jitsipopover_blue' data-i18n='" +
6048
-                local_address_key +"'>" +
6049
-                    translate(local_address_key) + "</span></td><td> " +
6046
+                local_address_key +"' data-i18n-options='" +
6047
+                    JSON.stringify({count: data.localIP.length}) + "'>" +
6048
+                    translate(local_address_key, {count: data.localIP.length}) +
6049
+                    "</span></td><td> " +
6050 6050
                 ConnectionIndicator.getStringFromArray(data.localIP) +
6051 6051
                 "</td></tr>";
6052 6052
             transport =
6053 6053
                 "<tr><td><span class='jitsipopover_blue' data-i18n='" +
6054
-                remote_address_key + "'>" +
6055
-                    translate(remote_address_key) + "</span></td><td> " +
6054
+                remote_address_key + "' data-i18n-options='" +
6055
+                    JSON.stringify({count: data.remoteIP.length}) + "'>" +
6056
+                    translate(remote_address_key,
6057
+                        {count: data.remoteIP.length}) +
6058
+                    "</span></td><td> " +
6056 6059
                 ConnectionIndicator.getStringFromArray(data.remoteIP) +
6057 6060
                 "</td></tr>";
6058 6061
 
6059
-            var key_remote = "connectionindicator.",
6060
-                key_local = "connectionindicator.";
6061
-
6062
-            if(this.transport.length > 1)
6063
-            {
6064
-                key_remote += "remoteports";
6065
-                key_local += "localports";
6066
-            }
6067
-            else
6068
-            {
6069
-                key_remote += "remoteport";
6070
-                key_local += "localport";
6071
-            }
6062
+            var key_remote = "connectionindicator.remoteport",
6063
+                key_local = "connectionindicator.localport";
6072 6064
 
6073 6065
             transport += "<tr>" +
6074 6066
                 "<td>" +
6075 6067
                 "<span class='jitsipopover_blue' data-i18n='" + key_remote +
6076
-                "'>" +
6077
-                translate(key_remote) + "</span></td><td>";
6068
+                "' data-i18n-options='" +
6069
+                JSON.stringify({count: this.transport.length}) + "'>" +
6070
+                translate(key_remote, {count: this.transport.length}) +
6071
+                "</span></td><td>";
6078 6072
             localTransport += "<tr>" +
6079 6073
                 "<td>" +
6080 6074
                 "<span class='jitsipopover_blue' data-i18n='" + key_local +
6081
-                "'>" +
6082
-                translate(key_local) + "</span></td><td>";
6075
+                "' data-i18n-options='" +
6076
+                JSON.stringify({count: this.transport.length}) + "'>" +
6077
+                translate(key_local, {count: this.transport.length}) +
6078
+                "</span></td><td>";
6083 6079
 
6084 6080
             transport +=
6085 6081
                 ConnectionIndicator.getStringFromArray(data.remotePort);
@@ -11630,7 +11626,6 @@ var defaultOptions = {
11630 11626
     detectLngQS: "lang",
11631 11627
     useCookie: false,
11632 11628
     fallbackLng: DEFAULT_LANG,
11633
-    shortcutFunction: 'defaultValue',
11634 11629
     load: "unspecific",
11635 11630
     resGetPath: 'lang/__ns__-__lng__.json',
11636 11631
     ns: {
@@ -11643,6 +11638,7 @@ var defaultOptions = {
11643 11638
     useDataAttrOptions: true,
11644 11639
     app: interfaceConfig.APP_NAME,
11645 11640
     getAsync: false,
11641
+    defaultValueFromContent: false,
11646 11642
     customLoad: function(lng, ns, options, done) {
11647 11643
         var resPath = "lang/__ns__-__lng__.json";
11648 11644
         if(lng === languages.EN)

+ 21
- 25
modules/UI/videolayout/ConnectionIndicator.js View File

@@ -229,47 +229,43 @@ ConnectionIndicator.prototype.generateText = function () {
229 229
 
230 230
             }
231 231
 
232
-            var local_address_key = "connectionindicator." +
233
-                (data.localIP.length > 1? "localaddresses" : "localaddress");
234
-            var remote_address_key = "connectionindicator." +
235
-                (data.remoteIP.length > 1? "remoteaddresses" : "remoteaddress");
232
+            var local_address_key = "connectionindicator.localaddress";
233
+            var remote_address_key = "connectionindicator.remoteaddress";
236 234
             var localTransport =
237 235
                 "<tr><td><span class='jitsipopover_blue' data-i18n='" +
238
-                local_address_key +"'>" +
239
-                    translate(local_address_key) + "</span></td><td> " +
236
+                local_address_key +"' data-i18n-options='" +
237
+                    JSON.stringify({count: data.localIP.length}) + "'>" +
238
+                    translate(local_address_key, {count: data.localIP.length}) +
239
+                    "</span></td><td> " +
240 240
                 ConnectionIndicator.getStringFromArray(data.localIP) +
241 241
                 "</td></tr>";
242 242
             transport =
243 243
                 "<tr><td><span class='jitsipopover_blue' data-i18n='" +
244
-                remote_address_key + "'>" +
245
-                    translate(remote_address_key) + "</span></td><td> " +
244
+                remote_address_key + "' data-i18n-options='" +
245
+                    JSON.stringify({count: data.remoteIP.length}) + "'>" +
246
+                    translate(remote_address_key,
247
+                        {count: data.remoteIP.length}) +
248
+                    "</span></td><td> " +
246 249
                 ConnectionIndicator.getStringFromArray(data.remoteIP) +
247 250
                 "</td></tr>";
248 251
 
249
-            var key_remote = "connectionindicator.",
250
-                key_local = "connectionindicator.";
251
-
252
-            if(this.transport.length > 1)
253
-            {
254
-                key_remote += "remoteports";
255
-                key_local += "localports";
256
-            }
257
-            else
258
-            {
259
-                key_remote += "remoteport";
260
-                key_local += "localport";
261
-            }
252
+            var key_remote = "connectionindicator.remoteport",
253
+                key_local = "connectionindicator.localport";
262 254
 
263 255
             transport += "<tr>" +
264 256
                 "<td>" +
265 257
                 "<span class='jitsipopover_blue' data-i18n='" + key_remote +
266
-                "'>" +
267
-                translate(key_remote) + "</span></td><td>";
258
+                "' data-i18n-options='" +
259
+                JSON.stringify({count: this.transport.length}) + "'>" +
260
+                translate(key_remote, {count: this.transport.length}) +
261
+                "</span></td><td>";
268 262
             localTransport += "<tr>" +
269 263
                 "<td>" +
270 264
                 "<span class='jitsipopover_blue' data-i18n='" + key_local +
271
-                "'>" +
272
-                translate(key_local) + "</span></td><td>";
265
+                "' data-i18n-options='" +
266
+                JSON.stringify({count: this.transport.length}) + "'>" +
267
+                translate(key_local, {count: this.transport.length}) +
268
+                "</span></td><td>";
273 269
 
274 270
             transport +=
275 271
                 ConnectionIndicator.getStringFromArray(data.remotePort);

+ 1
- 1
modules/translation/translation.js View File

@@ -13,7 +13,6 @@ var defaultOptions = {
13 13
     detectLngQS: "lang",
14 14
     useCookie: false,
15 15
     fallbackLng: DEFAULT_LANG,
16
-    shortcutFunction: 'defaultValue',
17 16
     load: "unspecific",
18 17
     resGetPath: 'lang/__ns__-__lng__.json',
19 18
     ns: {
@@ -26,6 +25,7 @@ var defaultOptions = {
26 25
     useDataAttrOptions: true,
27 26
     app: interfaceConfig.APP_NAME,
28 27
     getAsync: false,
28
+    defaultValueFromContent: false,
29 29
     customLoad: function(lng, ns, options, done) {
30 30
         var resPath = "lang/__ns__-__lng__.json";
31 31
         if(lng === languages.EN)

Loading…
Cancel
Save