[Neos] Multi-language: Translate Label using Main.xlf

Chanthorn Ngeth chanthorn at web-essentials.asia
Fri Jun 7 09:09:25 CEST 2013


Hi All,

I solved my problem, thanks to Christian for helping.
I have two files of Typoscript for "De" and "En" language. I declared 
"locale" variable there:
MyPackage/Resources/Private/TypoScripts/Nodes/en.ts2
page. at override.locale = 'en_EN'

MyPackage/Resources/Private/TypoScripts/Nodes/de.ts2
page. at override.locale = 'de_EN'

I passed variable "locale" to the Typoscript template:
page.body {
	parts{
		breadcrumb = Template
                 breadcrumb.templatePath = 
'resource://MyPackage/Private/Templates/TypoScriptObjects/BreadcrumbMenu.html'
                 breadcrumb.items = ${q(node).add(q(node).parents())}
                 breadcrumb.locale = ${locale}
	}
}

So in template I can get value of "locale" to translate my label:
<f:translate id="label.breadcrumb" locale="{locale}" />

Best regards,
Chanthorn
On 05/31/2013 03:33 PM, Chanthorn Ngeth wrote:
> Hi Christian,
>
> I can't find the way to declare variable of locale in TypoScript yet,
> could you give me some tip to declare it?
>
> Thanks,
> Chanthorn
>
> On 05/31/2013 09:10 AM, Chanthorn Ngeth wrote:
>> Hi Christian,
>>
>> Yes, it work with locale="en_US", I will try to get this locale value
>> from Typoscript.
>>
>> Regards,
>> Chanthorn
>>
>>
>>
>> On 05/30/2013 08:52 PM, Christian Müller wrote:
>>> Hi Chanthorn,
>>>
>>> so using
>>> <f:translate id="label.breadcrumb" locale="en_US"/>
>>> doesn't work?
>>>
>>> If you can get both labels with hardcoded locale you could then set the
>>> fitting locale in TypoScript and use that value in your template.
>>>
>>> CHeers,
>>> Christian
>>>
>>>
>>> On 29.05.13 21:09, Chanthorn Ngeth wrote:
>>>> Hi Christian,
>>>>
>>>> Thanks for your response, I have tried to with this way in my template:
>>>>
>>>> <f:translate id="label.breadcrumb" locale="de_DE"/>
>>>>
>>>> But my label always get value from "de" language, even I switch
>>>> language
>>>> to "en". What I really want is I can get flexible label from both of
>>>> them "de" and "en" while switch the language.
>>>>
>>>> What I am missing or did I do in the wrong way?
>>>>
>>>> I am looking forward to hearing from you soon,
>>>>
>>>> Cheers,
>>>> Chanthorn
>>>>
>>>>
>>>> On 05/30/2013 06:43 AM, Christian Müller wrote:
>>>>> Hi Chanthorn,
>>>>>
>>>>> you need to give the locale that you want to use to the translate
>>>>> viewhelper. Probably that is missing?
>>>>>
>>>>> Cheers,
>>>>> Christian
>>>>>
>>>>> On 29.05.13 03:04, Chanthorn Ngeth wrote:
>>>>>> I want a website with multi-language are "de" and "en".
>>>>>> I have created multi tree "de" and "en" then change html lang key
>>>>>> while
>>>>>> switch the language.
>>>>>> It's work fine for me but I have one more problem is to translate
>>>>>> label
>>>>>> in Main.xlf file.
>>>>>>
>>>>>> I have created two folders are "de" and "en" inside
>>>>>> MyPackage/Resources/Private/Translations/ add add Main.xlf file
>>>>>> there.
>>>>>>
>>>>>> What it does now is all the label get from "en" folder. So could you
>>>>>> give me some ideas to translate label when I switch language to "de"?
>>>>>
>>>>
>>>
>>
>>
>



More information about the Neos mailing list