i18n: when 0 likes or reshare displaied, translations says "One" #745
Labels
No labels
A: API
A: Backend
A: Federation
A: Front-End
A: I18N
A: Meta
A: Security
Build
C: Bug
C: Discussion
C: Enhancement
C: Feature
Compatibility
Dependency
Design
Documentation
Good first issue
Help welcome
Mobile
Rendering
S: Blocked
S: Duplicate
S: Incomplete
S: Instance specific
S: Invalid
S: Needs Voting/Discussion
S: Ready for review
Suggestion
S: Voted on Loomio
S: Wontfix
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: Plume/Plume#745
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
An Image worth more than a description:

See templates/posts/details.rs.html#L82
Plume version: master
Operating system: Linux
Web Browser: Firefox
Can you try with another language than french to see if you can reproduce? Because it seems to work fine in English. So maybe the issue is more with the French translation.
As i can see here are the entries in the translation files:
en.po:
fr.po:
where does macro i18n!() comes from ?
We wrote
i18nfor Plume, it comes from thegettext-macroscrate: https://github.com/Plume-org/gettext-macros/blob/main/src/lib.rs#L462And judging by what I see, it is more an issue with the "Plural-Forms" header in the fr.po file, that is either incorrect, or not parsed correctly by the Rust gettext implementation…
Unfortunately, Plural-Forms settings was overwritten...
Noooooo!
Then there are two solutions I can see:
build.rsouselves, at every compilation.And they are not mutually exclusive, we can do both.
Actually Crowdin is right about french using plurals for
n > 1. Zero is singular in french, which means the correct translations would bemsgstr[0] "{0} like"which means losing the all letters "Un"Oh, really? Thank you for important information.
I feel stupid right now, for not noticing it before… 😅
Would it work with that?
Maybe, because the header says
nplurals=2, so there may be two different plurals for French if I read this correctlynpluralscount how many variations there are, including singular, 2 is 1 singular plus 1 plural.@floreal your proposition would not work :
If we want to have "Aucun", "Un" or any number, there have to be 3 plurals (not that it requires changing all other french translation strings to have the same number of variations, and there is still the problem about Crowdin overwriting Plural-Forms):
(Not so) Short explanation of how plurals works in gettext :
nplurals describes how many variations there are. If its, say, 5, there are 5 variations, so each translations requieres to have msgstr[0] to msgstr[4].
plural is the formula that gives what msgstr has to be used, it must returns an integer < nplurals. For most languages it can be
n != 1orn > 1as they have only 1 plural (and 1 singular), false would be considered as 0, and true as 1 (as usually done in C). For more complex plural forms, one can use<inequality> ? <if it was true> : <if it was false>formula, like a C inline if statement. Imbrication is possible as many as you want (see Russian version for how complex it can get). I'll namereswhat was returned by the formulamsgstr[res] is chosen as the correct translation, based on the return value of plural.