vue-i18n
vue-i18n copied to clipboard
Linked message and pluralization
trafficstars
Clear and concise description of the problem
In some languages (as german i.e.) there exists the Genitive case in mostly appending a 's' char at the end. So I tried to solve it with pluralization:
auth: {
labels: {
password: "Passwort | Passworts",
...
password: {
change: {
error: "Fehler beim Ändern des @:auth.labels.password{'s'}"
but my problem is, to have it choiceabel in the linked message itself!?!
Of course , I can put a traling {'s'} but I wish to have a solution as this i.e.
@:auth.labels.password{[2]}
@:auth.labels.password|2
Suggested solution
To have the ability to add the proper index into the linked message
@:auth.labels.password{[index]}
or
@:auth.labels.password|index
Alternative
No response
Additional context
I hope, this topic wasn't discussed somwhere yet. I couldn't find anything regarding such an approach. Using: "vue": "^3.0.0", "vue-i18n": "^9.0.0",
Validations
- [X] Read the Contributing Guidelines
- [X] Read the Documentation
- [X] Check that there isn't already an issue that request the same feature to avoid creating a duplicate.
This works for me:
{
"validation": {
"plurals": {
"symbol": "no symbol | {n} symbol | {n} symbols"
},
"string": {
"min": "Min length @:validation.plurals.symbol"
}
}
}
t('validation.string.min', 3); // Min length 3 symbols
t('validation.string.min', 1); // Min length 1 symbol