-
-
Notifications
You must be signed in to change notification settings - Fork 730
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
When an article is setup by "item", if the quantity is more than one in the variant, the plural is not applied anymore #4172
Comments
I investigated this curious bug. We have duplicated code to define display_as value of variants, it's called option_value_namer. We have a version in ruby on the backend and a very similar (must have been copied) version of it in angular 🤕 The problem is that they are not exactly the same, i.e., the required pluralization is only done on the Ruby code. There's a TODO entry to add pluralization to the angular code: that's exactly what this issue is! I am tagging this a good first issue, note: javascript/coffeescript |
I was trying to find a way to make this pluralized unit name come from the server again and remove this code but it's too much trouble, it's complicated. |
Hm, that pluralize library seems to only know English. Trying to apply English pluralisation rules to German words would make this worse. Using server side translations may not help either:
|
I had a good look into this and found:
My conclusions are that we can't rely on a library to get this right and that it may be harmful if it tries to pluralise things it doesn't know. Requiring a developer to program new inflection rules or add irregular words is too much maintenance for this little feature. I came up with a relatively simple way to manage plurals within Transifex. We take the most popular unit names and add them to our language file as singular and plural. Both singular and plural can then get translated. Our code can look up if a unit name is in the dictionary and choose the right word. If it doesn't find it in the dictionary, it just leaves it as is. |
I extracted all used unit names from the French server. Can you check which ones are the most important to be pluralised? We can then cross-check with the English words to see if we need to add more. French unit names with usage count
|
@mkllnk here they are with their plural: "pièce"=> pièces |
Ah, great @RachL. Can you also tell me what the English translation is? |
hehe I even learned a few things :) "pièce"=> pièces pieces |
Do you mean flask? |
@mkllnk ahem. Yes. 🤦♂ |
Description
I remember that before v2, when a product was sold per "item", if the variant was for example "2 items", and the name of the item was "piece", it was displayed as "2 pieces" by default (with a s for plural).
It is not anymore in v2.
Expected Behavior
If sold per item, if quantity more than 1, plural should be applied automatically
Actual Behaviour
It is not
Steps to Reproduce
Animated Gif/Screenshot
Context
I saw that when doing customer support via skype screen sharing and noticed it.
Severity
bug-s3: a feature is broken but there is a workaround : we can manually write the display as field but we need to do it for every plural quantity, need to think about it...
Your Environment
Possible Fix
The text was updated successfully, but these errors were encountered: