From 6f12446c99b805f28680b329da1d546b9dc0d19b Mon Sep 17 00:00:00 2001 From: hristoterezov Date: Fri, 27 Feb 2015 19:58:05 +0200 Subject: [PATCH] Fixes translation of plurals. --- index.html | 2 +- lang/main.json | 8 ++-- libs/app.bundle.js | 48 +++++++++---------- modules/UI/videolayout/ConnectionIndicator.js | 46 ++++++++---------- modules/translation/translation.js | 2 +- 5 files changed, 49 insertions(+), 57 deletions(-) diff --git a/index.html b/index.html index a1f45f443..98bfba5fd 100644 --- a/index.html +++ b/index.html @@ -19,7 +19,7 @@ - + diff --git a/lang/main.json b/lang/main.json index 458e2f820..9dcf5a5a6 100644 --- a/lang/main.json +++ b/lang/main.json @@ -95,14 +95,14 @@ "less": "Show less", "more": "Show more", "address": "Address:", - "remoteports": "Remote ports:", - "localports": "Local ports:", + "remoteport_plural": "Remote ports:", + "localport_plural": "Local ports:", "remoteport": "Remote port:", "localport": "Local port:", "localaddress": "Local address: ", - "localaddresses": "Local addresses: ", + "localaddress_plural": "Local addresses: ", "remoteaddress": "Remote address: ", - "remoteaddresses": "Remote addresses: ", + "remoteaddress_plural": "Remote addresses: ", "transport": "Transport: ", "bandwidth": "Estimated bandwidth:", "na": "Come back here for connection information once the conference starts" diff --git a/libs/app.bundle.js b/libs/app.bundle.js index a1970201d..48d374033 100644 --- a/libs/app.bundle.js +++ b/libs/app.bundle.js @@ -6039,47 +6039,43 @@ ConnectionIndicator.prototype.generateText = function () { } - var local_address_key = "connectionindicator." + - (data.localIP.length > 1? "localaddresses" : "localaddress"); - var remote_address_key = "connectionindicator." + - (data.remoteIP.length > 1? "remoteaddresses" : "remoteaddress"); + var local_address_key = "connectionindicator.localaddress"; + var remote_address_key = "connectionindicator.remoteaddress"; var localTransport = "" + - translate(local_address_key) + " " + + local_address_key +"' data-i18n-options='" + + JSON.stringify({count: data.localIP.length}) + "'>" + + translate(local_address_key, {count: data.localIP.length}) + + " " + ConnectionIndicator.getStringFromArray(data.localIP) + ""; transport = "" + - translate(remote_address_key) + " " + + remote_address_key + "' data-i18n-options='" + + JSON.stringify({count: data.remoteIP.length}) + "'>" + + translate(remote_address_key, + {count: data.remoteIP.length}) + + " " + ConnectionIndicator.getStringFromArray(data.remoteIP) + ""; - var key_remote = "connectionindicator.", - key_local = "connectionindicator."; - - if(this.transport.length > 1) - { - key_remote += "remoteports"; - key_local += "localports"; - } - else - { - key_remote += "remoteport"; - key_local += "localport"; - } + var key_remote = "connectionindicator.remoteport", + key_local = "connectionindicator.localport"; transport += "" + "" + "" + - translate(key_remote) + ""; + "' data-i18n-options='" + + JSON.stringify({count: this.transport.length}) + "'>" + + translate(key_remote, {count: this.transport.length}) + + ""; localTransport += "" + "" + "" + - translate(key_local) + ""; + "' data-i18n-options='" + + JSON.stringify({count: this.transport.length}) + "'>" + + translate(key_local, {count: this.transport.length}) + + ""; transport += ConnectionIndicator.getStringFromArray(data.remotePort); @@ -11630,7 +11626,6 @@ var defaultOptions = { detectLngQS: "lang", useCookie: false, fallbackLng: DEFAULT_LANG, - shortcutFunction: 'defaultValue', load: "unspecific", resGetPath: 'lang/__ns__-__lng__.json', ns: { @@ -11643,6 +11638,7 @@ var defaultOptions = { useDataAttrOptions: true, app: interfaceConfig.APP_NAME, getAsync: false, + defaultValueFromContent: false, customLoad: function(lng, ns, options, done) { var resPath = "lang/__ns__-__lng__.json"; if(lng === languages.EN) diff --git a/modules/UI/videolayout/ConnectionIndicator.js b/modules/UI/videolayout/ConnectionIndicator.js index 44033ee23..0da668b13 100644 --- a/modules/UI/videolayout/ConnectionIndicator.js +++ b/modules/UI/videolayout/ConnectionIndicator.js @@ -229,47 +229,43 @@ ConnectionIndicator.prototype.generateText = function () { } - var local_address_key = "connectionindicator." + - (data.localIP.length > 1? "localaddresses" : "localaddress"); - var remote_address_key = "connectionindicator." + - (data.remoteIP.length > 1? "remoteaddresses" : "remoteaddress"); + var local_address_key = "connectionindicator.localaddress"; + var remote_address_key = "connectionindicator.remoteaddress"; var localTransport = "" + - translate(local_address_key) + " " + + local_address_key +"' data-i18n-options='" + + JSON.stringify({count: data.localIP.length}) + "'>" + + translate(local_address_key, {count: data.localIP.length}) + + " " + ConnectionIndicator.getStringFromArray(data.localIP) + ""; transport = "" + - translate(remote_address_key) + " " + + remote_address_key + "' data-i18n-options='" + + JSON.stringify({count: data.remoteIP.length}) + "'>" + + translate(remote_address_key, + {count: data.remoteIP.length}) + + " " + ConnectionIndicator.getStringFromArray(data.remoteIP) + ""; - var key_remote = "connectionindicator.", - key_local = "connectionindicator."; - - if(this.transport.length > 1) - { - key_remote += "remoteports"; - key_local += "localports"; - } - else - { - key_remote += "remoteport"; - key_local += "localport"; - } + var key_remote = "connectionindicator.remoteport", + key_local = "connectionindicator.localport"; transport += "" + "" + "" + - translate(key_remote) + ""; + "' data-i18n-options='" + + JSON.stringify({count: this.transport.length}) + "'>" + + translate(key_remote, {count: this.transport.length}) + + ""; localTransport += "" + "" + "" + - translate(key_local) + ""; + "' data-i18n-options='" + + JSON.stringify({count: this.transport.length}) + "'>" + + translate(key_local, {count: this.transport.length}) + + ""; transport += ConnectionIndicator.getStringFromArray(data.remotePort); diff --git a/modules/translation/translation.js b/modules/translation/translation.js index 575ba5377..6caa93933 100644 --- a/modules/translation/translation.js +++ b/modules/translation/translation.js @@ -13,7 +13,6 @@ var defaultOptions = { detectLngQS: "lang", useCookie: false, fallbackLng: DEFAULT_LANG, - shortcutFunction: 'defaultValue', load: "unspecific", resGetPath: 'lang/__ns__-__lng__.json', ns: { @@ -26,6 +25,7 @@ var defaultOptions = { useDataAttrOptions: true, app: interfaceConfig.APP_NAME, getAsync: false, + defaultValueFromContent: false, customLoad: function(lng, ns, options, done) { var resPath = "lang/__ns__-__lng__.json"; if(lng === languages.EN)