eZ Community » Forums » General » Translation of select options
expandshrink

Translation of select options

Translation of select options

Monday 15 October 2007 8:30:14 pm - 14 replies

Hello.

I've a custom class with a selection field in it. i would like to offer the user these two options in his language, but i don't know how.
i mean, let's suppose i have a select field with the options "one", "two" and "three". i would like to show these options to the user, but if the user is entering the spanish zone of my site i would like to show hime the options "uno", "dos" and "tres".

is this possible? thank you.

Monday 15 October 2007 9:25:24 pm

Tried to translate the class?
If that doesn't work, you can alwayse override the edit and view templates for that attribute to translate the values.

Modified on Monday 15 October 2007 9:28:09 pm by André R

Monday 15 October 2007 10:48:40 pm

Thank you Andre.

I tried that. i tried to edit the class in spanish, and i could change "labels" for fields. i mean, i can change "number" for "número" (spanish word for number). but if, in the spanish version of the class i change "one" to "uno", i always see "uno" for this option, in english and spanish...

do i miss something related to class translation?
thank you,.

Tuesday 16 October 2007 8:53:56 am

No probably not, seems the class translation is restricted to class and attribute names.
So you can either do the other thing I mentioned (translate it in the templates), or a third option would be to use object relations list set up in drop down mode. Then you can translate the relations as you wish.

Wednesday 21 September 2011 9:36:46 am

Hi,

I have been facing this bug in the last eZ Publish version, and I was very disapointed - A solution is needed to allow translation of ezselection (by the way i think the ezselection datatype should be rewrited).

I have been thinking about it a little bit, and as a workaround I used the i18n template operator in tpl but this is not really convenient.

So I have started to work on a patch, and I wanted to validate the possible solution I found:

When we look to the way data are stored in the contentclass_attribute table we see it is stored through an xml in data_text5 column this way:

 

 <?xml version="1.0" encoding="utf-8"?>
<ezselection>
  <options>
    <option id="0" name="Ws"/>
    <option id="1" name="Cn"/>
</options>
</ezselection>

So I was thinking it could be possible to store the language as an attribute of <options> tag this way:

<?xml version="1.0" encoding="utf-8"?>
<ezselection>
<options lang="fre-FR">
<option id="0" name="Webinaires"/><option id="1" name="Certification"/>
</options>
<options lang="eng-GB">
<option id="0" name="Webinars"/><option id="1" name="Certifs"/>
</options>
</ezselection>

What do you think about this solution ? Is there something that could make this solution innapropriate ?

Thanks for your feedback,

Nicolas

Modified on Wednesday 21 September 2011 9:37:28 am by Nicolas OTTAVI

Wednesday 21 September 2011 9:58:34 am

Hi Nicolas,

 

You should find some inspiration right here : http://projects.ez.no/ezselection2

 

Cheers

Wednesday 21 September 2011 10:17:04 am

Thanks Matthieu,

I have read about this ezselection2 project, but unless I am blind I can't find any source code for this project ... Subversion and Download tabs are "empty" ... I have tried to find something on github bug did not ... If you have some link where I could download it it would be useful, and may be make my "project" of rewriting ezselection not necessary anymore blunk.gif Emoticon

Merci

Nicolas

Wednesday 21 September 2011 10:29:20 am

Oh yes I forgot, here is the link http://zev.ez.no/svn/extensions/ezselection2/

But this is only a start with good ideas and unfortunately this is not a working solution....

Wednesday 21 September 2011 10:30:43 am

This problem is reported long time ago, pity that it is not yet solved (we needed it many times):

http://issues.ez.no/IssueView.php?Id=13975

http://issues.ez.no/IssueView.php?Id=15897

http://issues.ez.no/IssueView.php?Id=13248

http://issues.ez.no/IssueView.php?Id=16982

Wednesday 21 September 2011 10:36:05 am

Yes Ivo,

I know, this is why before starting to work on a solution I asking you as very experienced eZ developers if my solution could make sense blunk.gif Emoticon

Thx

Wednesday 21 September 2011 11:18:51 am

I would start with ezselection2 maybe ( sole reason: it solves the index being int problem, not allowing you to re arrange options later), "only" problem with it is that the developer that started on it tried to do to many things. There is yui 2.x stuff in there that should be scrapped by now, potentially rewritten in jQuery, but "kiss"..

So a simpler starting point would be to "enhancedselection" which also solved the index issue, its the one ezselection2 was based on, which again is based selection datatype in eZ Publish.

As for your translation proposal, could probably work. However as of 4.3 a new translatable attribute was added where you could place the data as xml or json (if you break the format, why not brak to one that is easier to use and takes less space blunk.gif Emoticon ). 

Modified on Wednesday 21 September 2011 11:19:32 am by André R

Wednesday 21 September 2011 11:29:26 am

Yes Ivo,

I know, this is why before starting to work on a solution I asking you as very experienced eZ developers if my solution could make sense blunk.gif Emoticon

Thx

We are just starting with translation feature in http://projects.ez.no/eztags blunk.gif Emoticon 

Though, I don't know when we will have something operational (http://projects.ez.no/eztags/forum/general/multilingual)

Modified on Wednesday 21 September 2011 11:32:16 am by Ivo Lukač

Wednesday 21 September 2011 12:24:07 pm

Ok,

Thanks all for your feedbacks.

André, as you suggest I will start from enhancedselection.
I will strongly consider storing data in json - however what is the translatable attribute you are mentionning ?
I will keep you posted

Regards,

Nicolas

Tuesday 19 June 2012 2:59:51 pm

Hi,

anyone know how I get rid of a class translation once it's created - don't need it, and would prefer to see it gone.

Using version 4.1.3

Tuesday 19 June 2012 11:14:44 pm

You should be able to go to the class/view page and in the translation section hit the "remove selected" as long as it's not the main language.  If it is the main language, change that first using the radio buttons and the "set main".

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from