[TYPO3-english] TYPO3 6.2.x: translating mechanisms within and without extensions

Bert Hiddink [BENDOO e-work solutions] hiddink at bendoo.nl
Sat Nov 8 19:50:07 CET 2014


Hello Jigal,

Thanks for your reply.

I had found and tested the option you mention:

In typo3conf/ext/news/Resources/Private/Language/
...I have...
locallang.xml

In this file, I have

...
			<label index="tags">Tags</label>
			<label index="myvar">Hola</label>
...

I put this in a Fluid page template:
<f:translate key="tags" extensionName="news" />
<f:translate key="myvar" extensionName="news" />

The first key prints "Tags", the second is empty...

If I change:
			<label index="tags">Tags</label>
to...
			<label index="tags">Tags changed</label>

...then...
<f:translate key="tags" extensionName="news" />
...still prints "Tags"...

So that means the locallang.xml is not taken into account?

Any ideas?

Thanks again!

Regards,
Bert

On 07-11-14 21:28, Jigal van Hemert wrote:
> Hi,
>
> On 07/11/2014 15:49, Bert Hiddink [BENDOO e-work solutions] wrote:
>> I would like to create a XML-language file I can use within my site
>> and/or extensions.
>>
>> What I understood from here:
>> http://stackoverflow.com/questions/20775407/how-to-use-xliff-outside-an-extension-in-typo3
>>
>>
>> ...this could be done like this in Fluid:
>>
>> <f:translate
>> id="LLL:typo3conf/ext/news/Resources/Private/Language/locallang.xml:more-links"
>>
>> />
>
> Since TYPO3 CMS still supports global and system extensions I'd go for:
> <f:translate
> id="LLL:EXT:news/Resources/Private/Language/locallang.xml:more-links" />
>
>> ...
>>      <data type="array">
>>          <languageKey index="default" type="array">
>>              <!-- Common -->
>>              <label index="more-link">Read more</label>
>> ...
>
>> However, if I change the index-key to "my-var":
>>
>> <f:translate
>> id="LLL:typo3conf/ext/news/Resources/Private/Language/locallang.xml:my-var"
>>
>> />
>>
>> ..it returns nothing...
>>
>> So what is happening here? Is News reading this language field from
>> another file? If yes, from where? And why could I not add custom-fields?
>
> Is the key "my-var" present in that locallang file? Probably not, so
> that would explain why it doesn't work.
>
> Another limitation from the syntax you use is that it will only work for
> the default language. If the frontend uses a different language it will
> still only show the labels for the default language.
>
> There is a nice solution: make yourself an extension and store a
> locallang file (xml or xliff will do) in Resources/Private/Language/. As
> long as the filename is "locallang" it will be loaded automatically.
>
> You can use the labels anywhere (also in fluid page templates) by using:
> <f:translate key="my-var" extensionName="myExtension" />
> (of course use my-var and myExtension with the names of your label and
> your extension)
> This way the selected language is also considered.
>



More information about the TYPO3-english mailing list