If I pass more values to $t then there are arguments in the message, the arguments may get the wrong values.
Example
I have these strings in the language file:
{
"message": {
"one": "{name} sent you 1 file",
"other": "{name} sent you {count} files"
}
}
Both messages are called with the same options:
// This is a function that returns the correct string based on the `count` value, because we cannot use ICU expressions
function pluralization(id, options) {
if (options.values.count === 1) {
return $t(`${id}.one`, options);
} else {
return $t(`${id}.other`, options);
}
}
console.log(pluralization('message', {values: {count: 1, name: 'John'}));
console.log(pluralization('message', {values: {count: 2, name: 'John'}));
This results in these result:
1 sent you 1 file
John sent you 2 files
Expected behavior
The arguments should be set correctly, even if there are too much values.
John sent you 1 file
John sent you 2 files
Workaround
Currently, we have to set the static 1 as a variable too.
{
"one": "{name} sent you {count} file",
"other": "{name} sent you {count} files"
}
If I pass more values to
$tthen there are arguments in the message, the arguments may get the wrong values.Example
I have these strings in the language file:
{ "message": { "one": "{name} sent you 1 file", "other": "{name} sent you {count} files" } }Both messages are called with the same options:
This results in these result:
Expected behavior
The arguments should be set correctly, even if there are too much values.
Workaround
Currently, we have to set the static
1as a variable too.{ "one": "{name} sent you {count} file", "other": "{name} sent you {count} files" }