Bug #33284

AbstractViewHelper::renderChildren removes the {some_digit} placeholders needed for translation

Added by Sebastian almost 10 years ago. Updated almost 10 years ago.

Status:
Rejected
Priority:
Won't have this time
Category:
Core
Start date:
2012-01-18
Due date:
% Done:

0%

Estimated time:
Has patch:
No

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;
    }

}

?>

#1

Updated by Karsten Dambekalns almost 10 years ago

  • Status changed from New to Rejected
  • Assignee 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.

Also available in: Atom PDF