How to translate data from ez selection datatype ?

Author Message

Helle Andersen

Friday 25 July 2008 4:59:38 am

We have a selection datatype (identifier 'finansieringsform') with four options: stipendiat, privatist, dba, erhvervsphd). These four options we need in Danish (as they are in the class in the admin interface) and in English.

In order to translate static text, e.g. translate 'Stipendiat' to 'Research fellow'

{'Stipendiat'|i18n('finansieringsform')}

 

works fine after adding the following to the translation.ts in /var/www/ezpublish/share/translations/dan-DK/

<context>
    <name>finansieringsform</name>
    <message>
        <source>Stipendiat</source>
        <translation>Research fellow</translation>
    </message>
</context>

The question is how to translate input from a selection type. We have tried every variation we could think of like

 {attribute_view_gui attribute=$node.object.data_map.finansieringsform|i18n('finansieringsform')}

but nothing works.

Another problem:
with the simple translation of static text, the text is translated, but the Danish 'Stipendiat' is shown in the English version and the 'research fellow' is shown in the Danish version.....
(our language setting is Danish as primary language and English as secondary language).

Any ideas ?

Helle Andersen

Thursday 28 August 2008 7:11:03 am

Well we found a solution:
1. we added an Eng-GB translations file in /ezpublish/share/translation with the content

<context>
    <name>finansieringsform</name>
    <message>
        <source>DBA</source>
        <translation>DBA</translation>
    </message>
    <message>
        <source>Privatist</source>
        <translation>Independent student</translation>
    </message>
    <message>
etc.

The reason for doing this was to make the selection attribute in the class in the admin module speak Danish rather than English

2. we added the following code in the template:

{let chosen_option=$node.object.data_map.finansieringsform.content.0}
       {$node.object.data_map.finansieringsform.class_content.options[$chosen_option].name|i18n('finansieringsform')}

michiel n.

Wednesday 10 December 2008 10:22:54 am

Please look at http://issues.ez.no/IssueView.php?Id=13248 (also look at related issues and on the forums).
The way you 'solve' it, isn't the best solution. Running ezlupdate will return an error.

Certified eZ developer looking for projects.
michieln at gmail dot com
http://ez.no/certification/verify/225305

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