-
-
Notifications
You must be signed in to change notification settings - Fork 861
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Linked Pluralization #195
Comments
up ? |
IMHO, you should not use "Linked message" (using @:) as it provides more complexity over usefulness. Having duplicated string in i18n messages is normal and provide flexibility and room for change. |
@amertum just to be sure i understand what you are saying I should have two strings in my locales file, one for singular and one for plural and to have something like {{ data.length > 0 ? $t('singular') : $t('plural') }} ? |
What I meant was : export default {
en: {
actions: {
photo: 'added 0 photo | added 1 photo | added {0} photos'
}
}
} {{ $tc('actions.photo', count, [count]) }} I agree that the documentation should be more prolixe about this. But it is clear in the source code ^^. |
I have a slightly different, but related problem. I have a set of common words together with their plural form in a |
@smares Duplicate strings is not a bad thing in messages. You should not seek for hard normalization. It will be difficult to maintain and it does not handle well with other languages pluralizations. |
While I agree with @amertum's point on duplicates not being a bad thing ,I don't fully agree with the points on maintenance and other languages causing problems In my particular use case: // en.js
export default {
name: 'Name',
collection: 'Collection | Collections',
file: 'File | Files',
collection_name: '@:collection @:name',
file_name: '@:file @:name'
}; the names Next to this, additional translations can be a lot smaller by using the fallback language for the combined messages like follows: // nl.js
export default {
name: 'Naam',
collection: 'Collectie | Collecties',
file: 'Bestand | Bestanden',
// use English fallback for collection_name & file_name
}; If the combined message doesn't fit well in the other language, the linked locale message can be updated on a per-instance basis: // nl.js
export default {
name: 'Naam',
collection: 'Collectie | Collecties',
file: 'Bestand | Bestanden',
// use English fallback for collection_name
// Override file_name for Dutch
file_name: '@:name van het @:file'
}; First syntax ideas:
OR:
@kazupon What are your thoughts on the matter? Would you be interested in figuring out an addition to the linked locale message syntax in order to support pluralization? |
if I'm reading this, I guess I'm needing this 👍 |
If this isn't possible I think linking and plural is kind of redundant as you still need to type the full sentence where you would otherwise just use a mix of plural and linked. Yes the functionals are usefull on their own but if you could mix them it would be event better. |
Hello all, Is there any update on this issue? |
This would be useful. The case that brought me here was to create translation files for time-stamping items such as messages. i.e. received {count} minutes ago |
Hi there. I am not familiar with this projects label structure, what does the |
we supported in Vue I18n v9. |
How do I exactly try v9? I only see v8 on github |
v9 can be found on https://github.com/intlify/vue-i18n-next |
Can anyone tell me which was the syntax chosen for this in v9 version? Thanks in advance. |
Hi, I've found out the way to use it. You need to provide the plural number like the way we use pluralization in general:
I hope Vue I18n will support providing plural numbers directly in linked messages like what @rijkvanzanten suggested. |
@vuong-cuong-phoenix thanks for the tip, that helps. |
but v9 don't supports vue2 so sad |
Hello, Is there a workaround to this issue? |
Hello, everyone Any news about this issue? I need to pluralize two differents terms in the same message, each of them should get its own counter result: "{n} resultado | {n} resultados"
founded: "{count} encontrado | {count} encontrados"
count: "Mostrando @:page.result de @:page.founded" I did try to pass t('count', {
n: 1,
count: 7
}) |
using vue 2.2.6 and vue-i18n 6.1.1
Can this be done?
I'm trying to do a "action string"
ex: User added 1 photo - if there are more photos i want to show "photos"
i have this
How do I pass the count parameter in a pluralized linked locale message ?
The text was updated successfully, but these errors were encountered: