Skip to content
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

Weird translation of zero count in plural messages (one ::: plural ::: none) #53

Open
infinite-dao opened this issue Dec 14, 2017 · 2 comments

Comments

@infinite-dao
Copy link

Using v1.8.0 and doing testing in the test folder: if I enter at “Number of blocks” 0 then the message comes out “We have 0 blocks” instead of “We have no blocks”. This is weird. Somehow function plurals.getTranslationIndex returns 1 which extracts from the message array “We have 0 blocks”.

Am I wrong or could this be fixed? Thank you

@tikiatua
Copy link
Member

Hi @infinite-dao,

Thank you for reporting this. Actually the problem is due to the way that multiple languages handle translations and the fact we introduced this at a later stage in the project and forgot to clean up the testing.

In the file src/vuex-i18n-plurals.js the available plural forms for all languages are defined. By default – which includes English – it will return the first form for 1 and the second form for all others. I.e. returning "We have 0 blocks" instead of "We have no blocks". Which basically both would be correct translations.

To make the use case work again, we would probably need to check, whether the default language specification is used and then also check if there is a third translation available which would then be used to define the zero translation string.

@tikiatua tikiatua added the bug label Dec 15, 2017
@Fluxlicious
Copy link

+1
Since it's not working you might want to follow Laravel's form:
zero ::: single ::: plural

@tikiatua tikiatua added this to To do in Version 2.0.0 Aug 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Version 2.0.0
  
To do
Development

No branches or pull requests

3 participants