[Neos] Label translation in yaml file

Bastian Waidelich bastian at typo3.org
Tue Jan 13 15:08:31 CET 2015


On 13.01.15, at 09:10, Sokly Phal wrote:

Hi Sokly,

> I found the solution now [...]

Well done, that's exactly the way to go.



> - In my custom Field.html file, I use <f:translate> viewhelper to render
> the translation
>
>      <f:translate id="{element.identifier}" package="My.SitePackage">

You can also refer to *renderingOptions.translationPackage* instead of 
hard-coding the package key. Also you could specify a different "source" 
if you don't want to mix-up your Main.xlf labels with form specific ones 
(like we already do for the validation messages[1]).
The result could look like:

{element.identifier -> f:translate(id: element.identifier, package: 
'{element.renderingOptions.translationPackage}', source: 'Forms')}:

To change the translation package, specify it in your form preset settings:

TYPO3:
   Form:
     presets:
       'yourPreset':
           'TYPO3.Form:Base':
             renderingOptions:
               translationPackage: 'Acme.YourPackage'

And don't forget to copy the ValidationErrors.xlf files to that package, 
too.

Best

[1] 
https://git.typo3.org/Packages/TYPO3.Form.git/blob/HEAD:/Resources/Private/Form/Layouts/Field.html

-- 
Bastian Waidelich


More information about the Neos mailing list