Multi-language support in panoramas

  • Hi,

    I'm trying to think of a way to support multiple languages in my virtual tours but other than duplicating the entire xml files I couldn't think of any.


    Is there any clever way of doing this? (i find duplicating all xml files is not a very good solution, just a hack around the problem).

    It would be nice if we could just put all the strings used in the panoramas in a single XML file and refer the strings by some ID (alfa-numeric).
    We could then duplicate this file for each language.

  • Hi

    You can do this using the <data> tag. Refer to the strings using the data's name. Then have 2 files where you define the same data values using different languages.
    This method still has a small annoyance. Since there is nothing like a conditional include or so, for each panorama you will need to have 3 files: one with the main code for the panorama; and the other two including the main file and with the data definitions in the corresponding language. For instance:

    Beach.xml - contains all the code for the panorama EXCEPT the string
    Beach-en.xml - includes Beach.xml and defines all the data values for english
    Beach-de.xml - includes Beach.xml and defines all the data values for german

    Loading each of the Beach-XX.xml files gives you the panorama in a different language.
    Strings which are shared across the panoramas (such as hover text for controls) can be placed on some other String-xx.xml file, which will be included in each of the "language" panorama files.

    Hope it helps. I think there was some other thread in the forum discussing this.
    Manuel

  • emediquei, the problem is I don't see how I could change the language from within the panorama itself.
    I would have to include xmls inside an if condition or something. I don't know if it is possible. Do you have any ideas on this?


    Also, let's say I have my strings as custom data tags. How do I refer a string inside a showtext() instruction. Can you give an example?


    Thanks,

  • To change the language, you would have to reload the photo, by loading either Beach-en.xml or Beach-de.xml . Each of them having the same <data> in a different language.


    For instance, to display a hoverText on a hotspot:

    in Beach.xml:
    <hotspot ...
    onhover="showText(get(data[buttonHoverText].content))" />

    in Beach-en.xml:
    <include url="Beach.xml/>

    <data name="buttonHoverText">
    <p>This is such a lovely beach</p>
    </data>

    in Beach-de.xml:
    <include url="Beach.xml/>

    <data name="buttonHoverText">
    <p>Es ist so eine schoene Strand</p>
    </data>

    In additon, for buttons which are displayed on the entire tour, there could be two other files "Global-en.xml" and "Global-de.xml" which would be included in all the "PANO-lang.xml" files, such as Beach-en.xml and Beach-de.xml

    Hope this helps!

  • Hi,

    It would be nice if we could just put all the strings used in the panoramas in a single XML file and refer the strings by some ID (alfa-numeric).
    We could then duplicate this file for each language.

    you could do something like that:
    building string tables for each language:

    and using an variable for the current language - e.g:

    Code
    set(language,english);

    and then getting the wanted string by:

    Code
    get(strings[get(lanuage)].text1)

    here an usage example:

    Code
    set(language,english);
    trace('text1=', get(strings[get(language)].text1) );
    trace('text2=', get(strings[get(language)].text2) );
    		
    set(language,german);
    trace('text1=', get(strings[get(language)].text1) );
    trace('text2=', get(strings[get(language)].text2) );


    or if you want a numeric index for each string:

    Code
    <strings name="english">
      <string name="0" text="Hello" />
      <string name="1" text="This text is written in English." />
    </strings>
    	
    <strings name="german">
      <string name="0" text="Hallo" />
      <string name="1" text="Das ist ein deutscher Text." />
    </strings>

    and:

    Code
    set(language,english);
    trace('text1=', get(strings[get(language)].string[0].text) );
    trace('text2=', get(strings[get(language)].string[1].text) );
    		
    set(language,german);
    trace('text1=', get(strings[get(language)].string[0].text) );
    trace('text2=', get(strings[get(language)].string[1].text) );

    best regards,
    Klaus

  • Nice!

    i had a nice way for this but the language selection is made before the tour..

    This one will work on the fly, doesn't it?

    Great!

    Tuur *thumbsup*

  • Code
    <strings name="SAINT">
    	<string name="12" text="var1" />
    	<string name="n12" text="var2" />
    </strings>


    Why when i use

    Code
    trace(get(strings[SAINT].string[12].text));

    it return "var2"?

  • Hi, recovering this from a long time but i want to achieve is multilanguage
    this is my structure
    i'm always messing with if's and get's and nulls and can't get it straight, sorry


    <itemdata name="name1" youtube="-someId">
    <language name="pt" sound="pt/17.mp3" text="name 1 in pt" />
    <language name="en" sound="en/17.mp3" text="name 1 in en" />
    <language name="es" sound="es/17.mp3" text="name 1 in es" />
    </itemdata>

    <itemdata name="name2" youtube="otherId" text="testname2">
    <language name="pt" sound="pt/18.mp3" text="name 2 in pt" />
    <language name="en" sound="en/18.mp3" text="name 2 in en" />
    <language name="es" sound="es/18.mp3" text="name 2 in es" />
    </itemdata>


    heres the action
    %1 is the name of itemData
    %2 is the attribute to get in the language
    the current language is in "lang" variable


    <action name="getLanguageContent">
    if (lang === null ,
    set(lang , 'ptPT');
    );

    subtxt(justLanguage , lang , 0 , 2) ;
    tolower(justLanguage);

    set(defaultLabelId , calc('itemdata[%1].%2' )) ;
    set(labelId , calc('itemdata[%1].language[' + lang + '].%2' )) ;
    set(labelIdNoCountry , calc('itemdata[%1].language[' + justLanguage + '].%2' )) ;

    set (labelIdResult , get(labelId));
    set (labelIdNoCountryResult , get(labelIdNoCountry));
    set (defaultLabelIdResult , get(defaultLabelId));

    if (get(labelIdResult) == get(labelId) ,
    if( get(labelIdNoCountryResult) == get(labelIdNoCountry) ,
    set ( %3 , defaultLabelIdResult );
    ,
    set ( %3 , get(labelIdNoCountryResult) );
    )
    ,
    set ( %3 , get(labelIdResult) );
    );

    </action>


    the supposed behaviour would be
    if language is ptPT go check if there is a "language" with name = ptPT.
    - if there is, check if there is the attribute %2.
    - if it exists return the value of it.
    - if it does not exists check for the presence in the language pt
    - if it does not exist return the "root" value


    getLanguageContent('name2' , 'text') would return testname2 because there is no more specific language to it (there is no language ptPT or language pt with that attribute.. so it gets the top one
    getLanguageContent('name1' , 'sound') would return pt/17.mp3 because there is no more specific language to it (there is no ptPT so it ould get the pt


    if tried with
    === null
    != null
    this version is equal to the "get" of the parent variable because i see in the trace they are the same
    i dont know what to do more

    trace of the resultvariable that are set prior to the If's
    INFO: 1 itemdata[name1].language[ptPT].text
    INFO: 2 name 1 in pt
    INFO: 3 itemdata[name1].text

    trace of %3

    INFO: itemdata[name1].language[ptPT].text


    it is more an IF problem and variable presence problem than language but.. sorry.. i cannot find a way for this to work

    hope someone helps

    thank you for your time

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!