multi language option using text field

  • I have been trying to use multiple languages in a text field as follows:


    text1="Hello"
    text2="This text is written in English."
    text3="Another English line"
    />

    text1="Nederlands"
    text2="Dit is nederlands"
    text3="Nog een nederlandse zin"
    />

    I set the language and test using the trace routine that the principle works:


    set(language,english);
    trace('data version - startup language=', get(language));
    trace('text1=', get(data[english].text1) );
    trace('text2=', get(data[get(language)].text2) );
    </action>

    which works as expected

    and then here's the text field (I have tried a host of ways to try and get some text to display in the HTML field...

    url="%SWFPATH%/plugins/textfield.swf"
    align="leftbottom" x="50" y="150" width="300"
    children="false"
    html="data:get(data[[get(language)]].text2) )"
    css="text-align:left; color:#FFFFFF; font-family:Arial; font-weight:bold; font-size:14px;"
    autoheight="true"
    ... etc

    the result ... is a display of -1 in the text field. I was rather hoping to see english message #2...

    Any ideas, anyone??

    Edited 3 times, last by MJE (August 23, 2012 at 6:55 AM).

  • Hi,

    first - I have moved your post to this separate thread, because it has nothing to do with the 1.0.8.15 release itself .

    about your problem - what you are trying to do is not possible!
    with 'data:' only the whole content of a <data> element can be addressed,

    as alternative you could use the onloaded event and set the html attribute manually,
    e.g.

    Code
    html=""
    onloaded="copy(html, data[get(language)].text2);"

    best regards,
    Klaus

  • Hi Klaus,
    Sorry about the wrong location for the post - I'm not much of a forum user. Thank you very much for your suggestion - that seems to do the trick, I now need to figure out how to re-fresh that text field(s) on the screen if the user changes the text field, but that's a more manageable problem.
    best regards
    Maris

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!