Bug #45062

TranslateViewHelper fails if an array with a single number is passed as arguments

Added by Timo Dödtmann over 2 years ago. Updated over 1 year ago.

Status:Resolved Start date:2013-02-01
Priority:Should have Due date:
Assigned To:- % Done:

100%

Category:I18n
Target version:-
PHP Version: Complexity:
Has patch:No Affected Flow version:Flow 2.0.0 beta 1

Description

If the TranslateViewHelper will passed "arguments" and this is now an array of a single number [array(0 => 123)], for example to tell that the password is too short, the Translator (\TYPO3\Flow\I18n\Translator) try's to find the plural form of this number (take a look in \TYPO3\Flow\I18n\Translator->translateById() which is called \TYPO3\Flow\I18n\Translator->getPluralForm()).
Normally this fails and the ViewHelper returns the passed "id" or "value".

The following line returns "Password must have x characters.", even if "myMessageId" is set correctly.

{f:translate(id:'myMessageId', arguments:{0:123}, value:'Password must have x characters.')}

If "myMessageId" use the placeholder {1} and

{f:translate(id:'myMessageId', arguments:{0:1, 1:123}, value:'Password must have x characters.')}

is called, then "myMessageId" wil be returned with "123" for the placeholder.


Related issues

duplicated by TYPO3.Fluid - Bug #46092: The f:translate ViewHelper does nothing if a integer is p... Resolved 2013-03-07
duplicated by TYPO3.Flow - Bug #49545: Non-plural translations are not found if arguments are used Closed 2013-07-01

Associated revisions

Revision 98748f8b
Added by Alexander Berl over 1 year ago

[!!!][BUGFIX] Translation not working with single numeric argument

This removes the option to provide the plural quantity as a single numeric
argument, as this was used nowhere but prevented translations from working
with such single arguments.

This change is breaking for cases where an application depends on previous
behavior that translateBy* calls with a single numeric argument would implicate
a quantity for plural form. Also classes extending I18n\Translator and using
protected method getPluralForm() will break due to a signature change.

Change-Id: I12e0856e7251684e6240c4350f4571c2207d769b
Fixes: #45062
Releases: master, 2.1

Revision 79e26ae9
Added by Alexander Berl over 1 year ago

[!!!][BUGFIX] Translation not working with single numeric argument

This removes the option to provide the plural quantity as a single numeric
argument, as this was used nowhere but prevented translations from working
with such single arguments.

This change is breaking for cases where an application depends on previous
behavior that translateBy* calls with a single numeric argument would implicate
a quantity for plural form. Also classes extending I18n\Translator and using
protected method getPluralForm() will break due to a signature change.

Change-Id: I12e0856e7251684e6240c4350f4571c2207d769b
Fixes: #45062
Releases: master, 2.1

History

#1 Updated by Gerrit Code Review over 2 years ago

  • Status changed from New to Under Review

Patch set 1 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/20130

#2 Updated by Gerrit Code Review over 2 years ago

Patch set 2 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/20130

#3 Updated by Gerrit Code Review over 2 years ago

Patch set 3 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/20130

#4 Updated by Gerrit Code Review about 2 years ago

Patch set 4 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/20130

#5 Updated by Gerrit Code Review about 2 years ago

Patch set 5 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/20130

#6 Updated by Adrian Föder about 2 years ago

  • Project changed from TYPO3.Fluid to TYPO3.Flow
  • Category deleted (ViewHelpers)

moved to TYPO3.Flow as this is more appropriate

#7 Updated by Adrian Föder about 2 years ago

  • Category set to I18n

#8 Updated by Gerrit Code Review over 1 year ago

Patch set 6 for branch master of project Packages/TYPO3.Flow has been pushed to the review server.
It is available at https://review.typo3.org/20130

#9 Updated by Gerrit Code Review over 1 year ago

Patch set 1 for branch 2.1 of project Packages/TYPO3.Flow has been pushed to the review server.
It is available at https://review.typo3.org/27811

#10 Updated by Alexander Berl over 1 year ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100

Also available in: Atom PDF