Browse Source

Merge pull request #190 from theurere/fix-translation-vars

Fix translation variable index for singular and plural translations
pull/180/merge
Simon Eisenmann 10 years ago
parent
commit
8ea12ec7b2
  1. 16
      static/js/services/translation.js

16
static/js/services/translation.js

@ -30,25 +30,25 @@ define(["jed", "underscore"], function(Jed, _) { @@ -30,25 +30,25 @@ define(["jed", "underscore"], function(Jed, _) {
this._ = _.bind(function() {
if (domain && context) {
return _.bind(function(singular) {
var vars = Array.prototype.slice.call(arguments, 0);
var vars = Array.prototype.slice.call(arguments, 1);
var r = i18n.translate(singular).onDomain(domain).withContext(context);
return r.fetch.apply(r, vars);
}, this);
} else if (domain) {
return _.bind(function(singular) {
var vars = Array.prototype.slice.call(arguments, 0);
var vars = Array.prototype.slice.call(arguments, 1);
var r = i18n.translate(singular).onDomain(domain);
return r.fetch.apply(r, vars);
}, this);
} else if (context) {
return _.bind(function(singular) {
var vars = Array.prototype.slice.call(arguments, 0);
var vars = Array.prototype.slice.call(arguments, 1);
var r = i18n.translate(singular).withContext(context);
return r.fetch.apply(r, vars);
}, this);
} else {
return _.bind(function(singular) {
var vars = Array.prototype.slice.call(arguments, 0);
var vars = Array.prototype.slice.call(arguments, 1);
var r = i18n.translate(singular);
return r.fetch.apply(r, vars);
}, this);
@ -59,25 +59,25 @@ define(["jed", "underscore"], function(Jed, _) { @@ -59,25 +59,25 @@ define(["jed", "underscore"], function(Jed, _) {
this._n = _.bind(function() {
if (domain && context) {
return _.bind(function(singular, plural) {
var vars = Array.prototype.slice.call(arguments, 1);
var vars = Array.prototype.slice.call(arguments, 2);
var r = i18n.translate(singular).onDomain(domain).withContext(context).ifPlural(vars[0], plural);
return r.fetch.apply(r, vars);
});
} else if (domain) {
return _.bind(function(singular, plural) {
var vars = Array.prototype.slice.call(arguments, 1);
var vars = Array.prototype.slice.call(arguments, 2);
var r = i18n.translate(singular).onDomain(domain).ifPlural(vars[0], plural);
return r.fetch.apply(r, vars);
});
} else if (context) {
return _.bind(function(singular, plural) {
var vars = Array.prototype.slice.call(arguments, 1);
var vars = Array.prototype.slice.call(arguments, 2);
var r = i18n.translate(singular).withContext(context).ifPlural(vars[0], plural);
return r.fetch.apply(r, vars);
});
} else {
return _.bind(function(singular, plural) {
var vars = Array.prototype.slice.call(arguments, 1);
var vars = Array.prototype.slice.call(arguments, 2);
var r = i18n.translate(singular).ifPlural(vars[0], plural);
return r.fetch.apply(r, vars);
})

Loading…
Cancel
Save