Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I ran the exact same test in French and in English. In both cases it passes, yet in the French interface I'm told there is one fail and 1 exception. Please see enclosed image
Cheers,
Albert
Comment | File | Size | Author |
---|---|---|---|
#8 | 1788008-good-practice-format-plural.patch | 1.51 KB | SebCorbin |
#3 | Screen Shot 2012-10-09 at 9.43.31 PM.png | 88.87 KB | alberto56 |
#3 | Screen Shot 2012-10-09 at 9.45.05 PM.png | 90.9 KB | alberto56 |
Screen Shot 2012-09-18 at 11.42.33 AM.png | 311.57 KB | alberto56 |
Comments
Comment #1
Anonymous (not verified) CreditAttribution: Anonymous commentedDoes this happen with 8.x-dev?
Comment #2
alberto56 CreditAttribution: alberto56 commented@earnie yup, same thing in D8 (latest dev). However this happens in French, but not in Spanish. (see enclosed images).
Because it seems to be a problem with the language file, I will document it more at http://localize.drupal.org/node/5133
Comment #3
alberto56 CreditAttribution: alberto56 commentedHere are the images
Comment #4
alberto56 CreditAttribution: alberto56 commentedInteresting: looking at the .po files in French and Spanish, there is no obvious difference. Can anyone figure out why it does this? Because I haven't found any obvious problem with the translations, I'm leaving this issue open until we can rule out a Drupal bug.
In French:
in Spanish:
Comment #5
SebCorbin CreditAttribution: SebCorbin commentedThis is due to the plural formulas of each language and an error in the french translation.
Reminder:
Problem is, most french contributor don't know that they HAVE TO use the @count variable also in the singular part. I can't blame them, a good practice would be to oblige developers to also use @count in the singular form, so that the @count is exported in the .pot file. This would also be of help for any language not using the "traditional" plural formula (nplurals=2; plural=(n!=1);)
TL;DR just fixed this in the french translation: http://localize.drupal.org/translate/languages/fr/translate?sid=204706 http://localize.drupal.org/translate/languages/fr/translate?sid=204708
Comment #6
alberto56 CreditAttribution: alberto56 commented@SebCorbin thanks, your response and explanation much appreciated! Made this into a feature request in case someone wants to look at it.
Cheers,
Albert.
Comment #7
Gábor HojtsyIndeed! Looks like a core patch would be in order?
Comment #8
SebCorbin CreditAttribution: SebCorbin commentedComments and reviews appreciated!
Comment #9
alberto56 CreditAttribution: alberto56 commented@SebCorbin thanks! Looks good.
Comment #10
Gábor HojtsyWhat about actually changing the use of format_plural() as well?
Comment #11
Damien Tournoud CreditAttribution: Damien Tournoud commentedThis is not a bug and works as designed.
The way plural forms are stored is independent on the language. The replacement of
@count
is available in all your plural forms. It's not because English doesn't have a@count
in its form 0 (singular) that you cannot use it in your form 0.Comment #12
SebCorbin CreditAttribution: SebCorbin commentedAs you said, this is not a bug, it's a task, for now we're not changing code, just improving documentation to make the work of translators easier.
Comment #13
SebCorbin CreditAttribution: SebCorbin commentedSo, back in the real discussion... Gabor, what do you mean by "changing the use of format_plural() as well?" (#10)
Comment #14
Gábor Hojtsy@SebCorbin: well, changing the docs does not fix core instances where format_plural() is used. So I meant fixing the actual uses of format_plural().
Comment #15
alberto56 CreditAttribution: alberto56 commentedHere is a related issue:
#2273889: Don't use one language's plural index formula with another language's string in the case of untranslated strings using format_plural().
I was still experiencing the original problem where I was seeing 1 fail in French and 0 fails in English, due to an incomplete import of French strings.
I solved this by doing a complete import which contains: