Bug #45062

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

Added by Timo Dödtmann over 8 years ago. Updated over 7 years ago.

Status:
Resolved
Priority:
Should have
Assignee:
-
Category:
I18n
Target version:
-
Start date:
2013-02-01
Due date:
% Done:

100%

Estimated time:
PHP Version:
Has patch:
No
Complexity:

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

Has duplicate TYPO3.Fluid - Bug #46092: The f:translate ViewHelper does nothing if a integer is provided as argumentResolved2013-03-07

Actions
Has duplicate TYPO3.Flow - Bug #49545: Non-plural translations are not found if arguments are usedClosed2013-07-01

Actions

Also available in: Atom PDF