Bug #33284
AbstractViewHelper::renderChildren removes the {some_digit} placeholders needed for translation
Status: | Rejected | Start date: | 2012-01-18 | |
---|---|---|---|---|
Priority: | Won't have this time | Due date: | ||
Assigned To: | Karsten Dambekalns | % Done: | 0% |
|
Category: | Core | |||
Target version: | TYPO3 Flow Base Distribution - 1.1 | |||
Has patch: | No | Affected Flow version: | Git master |
Description
Somewhere in renderChildren the {some_digit} placeholders are being removed.
I traced it so far and can't go further as I don't know how to debug the closure function.
To be clear... the example from the flow3 documentation guide:
<f:translate source="someLabelsCatalog" arguments="{0: 'foo', 1: '99.9'}>Untranslated {0} and {1,number}</f:translate>
becomes:
Übersetzt and 99,9
I don't know if maybe this was necessary at some step and is related to some important design decision or if it is a glitch.
If it's a glitch I hope someone can find it.
Otherwise I would suggest creating a StringFormatter like I did for myself, so one can then use:
<f:translate source="someLabelsCatalog" arguments="{0: 'foo', 1: '99.9'}>Untranslated {0,string} and {1,number}</f:translate>
Here is the StringFormatter
<?php namespace TYPO3\FLOW3\I18n\Formatter; /* * * This script belongs to the FLOW3 framework. * * * * It is free software; you can redistribute it and/or modify it under * * the terms of the GNU Lesser General Public License, either version 3 * * of the License, or (at your option) any later version. * * * * The TYPO3 project - inspiring people to share! * * */ use TYPO3\FLOW3\Annotations as FLOW3; /** * Formatter for numbers. * * @FLOW3\Scope("singleton") * @api */ class StringFormatter implements \TYPO3\FLOW3\I18n\Formatter\FormatterInterface { /** * Formats provided value using optional style properties * * @param mixed $value Formatter-specific variable to format (can be integer, \DateTime, etc) * @param \TYPO3\FLOW3\I18n\Locale $locale Locale to use * @param string $styleProperties Integer-indexed array of formatter-specific style properties (can be empty) * @return string String representation of $value provided, or (string)$value * @api */ public function format($value, \TYPO3\FLOW3\I18n\Locale $locale, array $styleProperties = array()) { return (string)$value; } } ?>
History
#1 Updated by Karsten Dambekalns over 3 years ago
- Status changed from New to Rejected
- Assigned To set to Karsten Dambekalns
- Priority changed from Must have to Won't have this time
- Target version set to 1.1
Well, {} are Fluid variable delimiters. So you'd need to put the translate tag content into a CDATA section.
Or (and at that point the example in the manual sucks!) use translation by id, that is recommended anyway.