Localization and dinamically include xml

  • I am trying to build a panorama with localization support, so the textfield in the panorama changes depending on the visitor selected language.

    To do this I was trying to include dinamically a language specific xml containig the textfield in the user language.

    I define a flashvar in the script that embeds the swfobject2.1 as:

    'include.url': "mylanguagespecific.xml"

    but nothing is included.

    Where I am wrong?

    Thanks

  • Where do you want the visitor to select the language?

    You could do something within krpano like this...

    Setup some image plugins to display the flag icons representing the languages supported. Something like what is at the top right of this site with the split British / American flag for English and the German flag for German.

    Use the onclick attributes for the flag plugins to set the html attribute of your textfield plugin to display the correct data:html.

    Hope that makes sense. *smile*

  • Hi,

    the <include url="..." /> tag is a special one,
    it is parsed and resolved during the loading of an xml file, so it can be only used inside a xml file,

    a way to use separate language xml files would be to load the language xml in the html first,
    and then include there the normal pano,

    e.g.
    html: (swfobject2.1):

    Code
    pano: "english.xml"  or pano: "german.xml"

    english.xml:

    Code
    <krpano>
       ..
      <include url="mainpano.xml" />
    </krpano>


    german.xml:

    Code
    <krpano>
        ..
       <include url="mainpano.xml" />
     </krpano>


    or pass a user defined variable (e.g. just "language") and check it with the new "if" action (1.0.8 beta only)
    e.g.

    html: (swfobject2.1):

    Code
    language: "english"

    xml:

    best regards,
    Klaus

  • Hello,

    I'm trying to do something similar, without setting a variable in the html as I want to use the tour as a standalone application, so instead only within flash.

    I want to use a combobox to set a global language variable - that when I set the html attribute of the textbox on the 'onload' of each scene, it checks for the language variable and loads the corresponding html file, which is in a different language.

    Ideally I could do something similar for the the showtext functions on hotspots etc.

  • Hmmm... this should be possible with something like...

    That would get your variable defined.

    However, if you've already loaded your pano with text in English... and then someone uses the combobox to select French... you would need to define an action to reload those items so that the correct language was used.

    If you are doing a standalone system, you could load an intro screen without a pano... where the language would be selected... and then should carry over to every future loaded pano.

  • Quote

    However, if you've already loaded your pano with text in English... and then someone uses the combobox to select French... you would need to define an action to reload those items so that the correct language was used.

    Is the only way I could see to do it, but my plan is for massive tours with many panoramas, hotspots etc and trying to keep track of every one using this system will be very confusing.

    Quote

    If you are doing a standalone system, you could load an intro screen without a pano... where the language would be selected... and then should carry over to every future loaded pano.

    This would be better. I'm not sure how to set an intro scene tho. And would I then just create a new xml document for each language with the changes in each one?

  • For an intro screen... load an xml without a pano defined (i.e. no image node).

    You can load plugins like a combobox... or a textfield... or a regular image... and initiate other xml / panos loading from there.

    Quote

    would I then just create a new xml document for each language with the changes in each one

    hmmm...

    Quote

    massive tours with many panoramas

    There might be a couple ways to do this... but either way... for every bit of text on the screen... you'll need to define it for as many languages as you want to support.

    For common plugins like controls... you would define all the languages in a single xml that defined all of your control items.

    But each pano would need each of it's unique hotspots translated within it's own xml.

    It would be a good challenge... but not impossible.

  • Cool.. I'll try that intro screen.

    I've put all of the text elements into a new xml file (datasources).

    Would it be possible to change the targeting include url to another one, i.e. set(inc...)

    I'll have a go but it already seems to me that it might not work!

    Cheers

  • Got it working with this -

    Thanks for you help!

  • A further improvement could be made -

    Rather then have all of this -

    Code
    if(language == english,set(plugin[text].html,data:en_%1));
    		if(language == french,set(plugin[text].html,data:fr_%1));
    		if(language == spanish,set(plugin[text].html,data:sp_%1));
    		if(language == german,set(plugin[text].html,data:de_%1));

    Would it be possible to get the language variable into the set action, something like this -

    Code
    set(plugin[text].html,data:get(language)_%1));

    Klaus - if it's not too much to ask I'd love to have your input on one of these questions I've posted!

  • Would it be possible to get the language variable into the set action, something like this -

    Code
    set(plugin[text].html,data:get(language)_%1));

    Hi,

    "get()" can be only used for a single parameter,
    so that would be only possible by using an additional action,
    e.g.

    Code
    <action name="sethtmldata">
    set(plugin[%1].html,data:%2_%3));
    </action>
    
    
    ...
    sethtmldata( text, get(language), ??? );

    %1 = name of the plugin
    %2 = the language
    %3 = the data name

    best regards,
    Klaus

  • Thanks Klaus,

    That part worked, but I'm also trying to use showtext for some onhover text over hotspots.

    I've gone round and round in circles and got to this -

    Code
    <action name="hs_text">
    		set(textdata,txtadd("data:",get(lang),"_",%2));
    		set(hotspot[%1].onhover,showtext(get(textdata),STYLE));
    		</action>
    .....
    hs_text(d_ext2int_trigger,hs_ext2int)

    To try and build the string that calls the right data node, but it just shows " txtadd("data:",get(lang),"_",hs_ext2int)"

    How do I get a variable into showtext using txtadd I suppose is what I'm asking??

Participate now!

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