Interpolate named counts in JS

Even though JS does the `%d` interpolation in `n__` using a string
replacement. This would not be compatible with the ruby
implementation.

Therefore using named variables instead.
This commit is contained in:
Bob Van Landuyt 2018-05-07 18:36:38 +02:00
parent 3b5ce6945d
commit a9ebcfa5f5

View file

@ -38,14 +38,17 @@ export default {
return this.modifiedFilesLength ? 'multi-file-modified' : '';
},
additionsTooltip() {
return sprintf(n__('1 %{type} addition', '%d %{type} additions', this.addedFilesLength), {
return sprintf(n__('1 %{type} addition', '%{count} %{type} additions', this.addedFilesLength), {
type: this.title.toLowerCase(),
count: this.addedFilesLength,
});
},
modifiedTooltip() {
return sprintf(
n__('1 %{type} modification', '%d %{type} modifications', this.modifiedFilesLength),
{ type: this.title.toLowerCase() },
n__('1 %{type} modification', '%{count} %{type} modifications', this.modifiedFilesLength), {
type: this.title.toLowerCase(),
count: this.modifiedFilesLength,
},
);
},
titleTooltip() {