Closed (won't fix)
Project:
Drupal core
Version:
9.2.x-dev
Component:
base system
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
19 Apr 2011 at 10:52 UTC
Updated:
5 Dec 2020 at 17:52 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
elky commentedComment #2
damien tournoud commentedNot sure what to do with the negative numbers. Gettext itself only supports positive numbers, and has some discussion about negative and floating point numbers (suggesting to treat them as plural... which does not really solve the translation issue).
Also, some people seem to say that s"minus one" should be plural, as in "minus one apples".
Whatever we do, this seems to be a larger subject then just the
$count == 1, so marking as needs work for now.Comment #3
shravan sonkar commentedfixed
Comment #4
shravan sonkar commentedComment #5
David Hernández commentedHello!
Thank you for working on this issue!
We should all try and use the same sprint tag. According to https://groups.drupal.org/node/447258 it should be SprintWeekend2015 with no #.
Comment #6
mile23Cursory examination says this issue is still outstanding in D8.
Here's a change record about
format_plural(): https://www.drupal.org/node/2173787 Basically it's part of thestring_translationservice now.There's an existing test here:
Drupal\locale\Tests\LocalePluralFormatTest::testGetPluralFormat()which seems to test for negative values, but the inline documentation makes it hard to tell.The actual substitution is done in
Drupal\Core\StringTranslation\PluralTranslatableMarkup::render().Marking this as needs reroll, even though it's really more of a refactor.
Comment #7
alvar0hurtad0According to #6 this is the fix to check if positive.
Comment #9
alvar0hurtad0Sorry, last patch uploaded empty
Comment #10
lokapujya-1 should remain plural. If you want it to be singular then you should pass in the absolute value to format_plural()
besides, "-1 vote(s) against" is a double negative and so the minus symbol probably shouldn't be displayed.
Comment #13
vacilando commentedComment #14
vacilando commentedToo late for 8.2.x; changing the core version to 8.3.x. and queueing a test for that branch.
Comment #15
vacilando commentedTest OK — patch #9 works as expected for 8.3.x.
Comment #16
vacilando commentedComment #21
mondrake#9 still passes after 3 years!
#10: IMO this issue is legitimate. See #3001398-5: format_size() fixes
So you may want to display "File bingo-bongo.txt size diff is -1 byte."
This needs tests, NW for that.
Comment #22
googletorp commentedTo me it's crazy that some so simple has been sitting for 3 years without getting committed.
So I added test case for this, fixed a code standards issue in the original patch and supplied a test only and final patch for this.
Regarding if -1 should be plural or singular - there is a long read here: https://english.stackexchange.com/questions/9735/is-1-followed-by-a-sing...
The short version is comparing a text like:
"Account ballance: -1 dollar" and "Account ballance: -1 dollars".
The general consensus seems to be that the amount of 1 (regardless of positive or negative) is singular.
Comment #24
googletorp commentedRetesting patch, looks like some issue with Selenium server caused fail, even though all tests was passed.
Comment #25
mondrakeThank you! RTBC
Comment #26
alexpottI agree with #10 / @lokapujya. The example in the issue summary feels a bit weird as I would expect it to be
1 vote for, 1 votes againstand the caller to make the number absolute since the negativity is conveyed by the wordagainst. I think it is quite rare to call PluralTranslatableMarkup with a negative number - since normally with countable things you don't have - of them. Ie. you don't have -1 vote against, you have 1 vote against.I think we could improve the documentation to suggest the $count should be a positive number and maybe deprecate calling this with negative numbers - unless we can come up with some better examples. An example of negative votes I can think of on the internet is arstechnica's +/- system of votes on comments but they don't put any words around that.
Comment #27
alexpottWe also need to check that this logic would make sense for other languages. I think it does in english but I'm not sure, thinking about -1 apple hurts my brain.
Comment #28
googletorp commentedComment #29
alexpott@googletorp you're right that balance is a much better example. However, for me I feel that
-1 poundsis better then-1 pound- there is not a real consensus on the stack exchange article you point to.For example it says:
Comment #30
alexpottI guess what I'm saying is that it depends on the context whether using the plural or singular form is correct so picking one over the over is never going to be write for all cases. So I think we need to encode whether to use singular or plural forms into the string itself because then different languages can encode this differently as it is highly likely that the rules are completely different for different languages.
Comment #31
mondrakeBesides the linguistic debate, I am afraid we have a more immediate problem looking at the guidance given for
PluralTranslatableMarkuparguments:The fact that we are saying "Do not use @count in the singular string." means that we are unable to print out the negative singular, or that we have a string that may be out of context.
Changing to use @count means most if not all singular strings would need to be changed and translated.
I think this is a won't fix as there won't be a one-fits-all solution.
Special use cases for negative singular should probably be dealt with by calling code, like the '-1 byte' vs '-1 bytes' case being discussed at #3001398: format_size() fixes.
Comment #36
mondrakeSounds like won't fix ATM. Anybody feel free to reopen if more arguments.