Skip to content

Commit

Permalink
fix(i18n): updatetranslations to pass params
Browse files Browse the repository at this point in the history
related issue #273
  • Loading branch information
zewa666 committed Jun 6, 2018
1 parent b9d147a commit 443fcf5
Show file tree
Hide file tree
Showing 9 changed files with 9,665 additions and 8 deletions.
9 changes: 8 additions & 1 deletion dist/amd/i18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,15 +163,22 @@ define(['exports', 'aurelia-logging', 'i18next', 'aurelia-pal', 'aurelia-event-a
for (i = 0, l = nodes.length; i < l; i++) {
var node = nodes[i];
var keys = void 0;
var params = void 0;

for (var i2 = 0, l2 = this.i18next.options.attributes.length; i2 < l2; i2++) {
keys = node.getAttribute(this.i18next.options.attributes[i2]);
var pname = this.i18next.options.attributes[i2] + '-params';

if (pname && node.au && node.au[pname]) {
params = node.au[pname].viewModel.value;
}

if (keys) break;
}

if (!keys) continue;

this.updateValue(node, keys);
this.updateValue(node, keys, params);
}
};

Expand Down
9 changes: 8 additions & 1 deletion dist/aurelia-i18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -693,16 +693,23 @@ export class I18N {
for (i = 0, l = nodes.length; i < l; i++) {
let node = nodes[i];
let keys;
let params;
//test every attribute and get the first one that has a value
for (let i2 = 0, l2 = this.i18next.options.attributes.length; i2 < l2; i2++) {
keys = node.getAttribute(this.i18next.options.attributes[i2]);
const pname = this.i18next.options.attributes[i2] + '-params';

if (pname && node.au && node.au[pname]) {
params = node.au[pname].viewModel.value;
}

if (keys) break;
}
//skip if nothing was found
if (!keys) continue;

//split the keys into multiple keys separated by a ;
this.updateValue(node, keys);
this.updateValue(node, keys, params);
}
}

Expand Down
9 changes: 8 additions & 1 deletion dist/commonjs/i18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,15 +153,22 @@ var I18N = exports.I18N = (_temp = _class = function () {
for (i = 0, l = nodes.length; i < l; i++) {
var node = nodes[i];
var keys = void 0;
var params = void 0;

for (var i2 = 0, l2 = this.i18next.options.attributes.length; i2 < l2; i2++) {
keys = node.getAttribute(this.i18next.options.attributes[i2]);
var pname = this.i18next.options.attributes[i2] + '-params';

if (pname && node.au && node.au[pname]) {
params = node.au[pname].viewModel.value;
}

if (keys) break;
}

if (!keys) continue;

this.updateValue(node, keys);
this.updateValue(node, keys, params);
}
};

Expand Down
9 changes: 8 additions & 1 deletion dist/es2015/i18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,15 +122,22 @@ export let I18N = (_temp = _class = class I18N {
for (i = 0, l = nodes.length; i < l; i++) {
let node = nodes[i];
let keys;
let params;

for (let i2 = 0, l2 = this.i18next.options.attributes.length; i2 < l2; i2++) {
keys = node.getAttribute(this.i18next.options.attributes[i2]);
const pname = this.i18next.options.attributes[i2] + '-params';

if (pname && node.au && node.au[pname]) {
params = node.au[pname].viewModel.value;
}

if (keys) break;
}

if (!keys) continue;

this.updateValue(node, keys);
this.updateValue(node, keys, params);
}
}

Expand Down
9 changes: 8 additions & 1 deletion dist/native-modules/i18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,15 +134,22 @@ export var I18N = (_temp = _class = function () {
for (i = 0, l = nodes.length; i < l; i++) {
var node = nodes[i];
var keys = void 0;
var params = void 0;

for (var i2 = 0, l2 = this.i18next.options.attributes.length; i2 < l2; i2++) {
keys = node.getAttribute(this.i18next.options.attributes[i2]);
var pname = this.i18next.options.attributes[i2] + '-params';

if (pname && node.au && node.au[pname]) {
params = node.au[pname].viewModel.value;
}

if (keys) break;
}

if (!keys) continue;

this.updateValue(node, keys);
this.updateValue(node, keys, params);
}
};

Expand Down
9 changes: 8 additions & 1 deletion dist/system/i18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,15 +147,22 @@ System.register(['aurelia-logging', 'i18next', 'aurelia-pal', 'aurelia-event-agg
for (i = 0, l = nodes.length; i < l; i++) {
var node = nodes[i];
var keys = void 0;
var params = void 0;

for (var i2 = 0, l2 = this.i18next.options.attributes.length; i2 < l2; i2++) {
keys = node.getAttribute(this.i18next.options.attributes[i2]);
var pname = this.i18next.options.attributes[i2] + '-params';

if (pname && node.au && node.au[pname]) {
params = node.au[pname].viewModel.value;
}

if (keys) break;
}

if (!keys) continue;

this.updateValue(node, keys);
this.updateValue(node, keys, params);
}
};

Expand Down
9 changes: 8 additions & 1 deletion dist/temp/aurelia-i18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -708,15 +708,22 @@ var I18N = exports.I18N = (_temp = _class2 = function () {
for (i = 0, l = nodes.length; i < l; i++) {
var node = nodes[i];
var keys = void 0;
var params = void 0;

for (var i2 = 0, l2 = this.i18next.options.attributes.length; i2 < l2; i2++) {
keys = node.getAttribute(this.i18next.options.attributes[i2]);
var pname = this.i18next.options.attributes[i2] + '-params';

if (pname && node.au && node.au[pname]) {
params = node.au[pname].viewModel.value;
}

if (keys) break;
}

if (!keys) continue;

this.updateValue(node, keys);
this.updateValue(node, keys, params);
}
};

Expand Down
Loading

0 comments on commit 443fcf5

Please sign in to comment.