Forums / Setup & design / Translating new user registration form

Translating new user registration form

Author Message

Jeroen Sangers

Tuesday 17 October 2006 4:24:21 am

I want to translate the new user registration form (/user/register). Most of this page is processed correctly by the i18n function, but the field names will always show up in English, as the template uses {$ContentObjectAttribute:item.contentclass_attribute.name} to display them.

Is there any way I can translate the fields labels as well?

Claudia Kosny

Thursday 19 October 2006 9:18:18 am

Hi Jeroen

This is on the roadmap for EZ 3.9 so you can try the release candidate if it is just for testing.
For current releases you can add the original content of such a field label and its translation into the translation.ts manually.
Example:
Your $ContentObjectAttribute:item.contentclass_attribute.name can have the values 'First name' and 'Last name'.

Your template looks like this:

...
<label for="foo">{$ContentObjectAttribute:item.contentclass_attribute.name|i18n('my_context')}</label>
...

Then add this to the translation.ts

<context>
    <name>my_context</name>
    <message>
        <source>First name</source>
        <translation>Nombre</translation>
    </message>
    <message>
        <source>Last name</source>
        <translation>Apellido</translation>
    </message>
</context>

You can name the context whatever you want as long as it is the same in the template and in the translation.ts.
Then the translation will work fine as the variables are evaluated before the i18n is applied.

Unfortunately the template will now cause problems if you use the ezlupdate tool as it exits if the input for i18n is not an encapsulated string. I actually wanted to fix that but haven't had the time yet.

Greetings from Luxembourg

Claudia