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

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 20 2025 19:59:15
Script start
Timing: Jan 20 2025 19:59:15
Module start 'layout'
Timing: Jan 20 2025 19:59:15
Module start 'content'
Timing: Jan 20 2025 19:59:16
Module end 'content'
Timing: Jan 20 2025 19:59:16
Script end

Main resources:

Total runtime1.0693 sec
Peak memory usage4,096.0000 KB
Database Queries54

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0045 589.4609151.2266
Module start 'layout' 0.00450.0025 740.687536.6797
Module start 'content' 0.00701.0613 777.3672520.5625
Module end 'content' 1.06830.0009 1,297.92977.8281
Script end 1.0692  1,305.7578 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00280.2611160.0002
Check MTime0.00110.1073160.0001
Mysql Total
Database connection0.00070.064510.0007
Mysqli_queries1.032996.6020540.0191
Looping result0.00040.0368520.0000
Template Total1.030596.420.5152
Template load0.00190.180520.0010
Template processing1.028596.192320.5143
Template load and register function0.00010.010010.0001
states
state_id_array0.00170.157410.0017
state_identifier_array0.00190.173420.0009
Override
Cache load0.00160.1497210.0001
Sytem overhead
Fetch class attribute can translate value0.00040.036820.0002
Fetch class attribute name0.00080.078430.0003
XML
Image XML parsing0.00170.158720.0008
class_abstraction
Instantiating content class attribute0.00000.000630.0000
General
dbfile0.00350.3306160.0002
String conversion0.00000.000640.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
1content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
2content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
5content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
2content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
2content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 14
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs