Sie sind nicht angemeldet.

nautama

Schüler

  • »nautama« ist der Autor dieses Themas

Beiträge: 82

Wohnort: La Paz, Baja California Sur, México

Beruf: KRpano programmer at www.imagen360.com

  • Nachricht senden

1

Donnerstag, 11. September 2014, 18:42

Is There Something Like A Personalized "devices" Attribute?

Hello all, I'm trying to add the possibility to have multiple idioms in a tour, the first idea was to multiply the tour.xml file and translate every text inside the new files, but this would be problematic if I wanted to edit the tour because I would have to edit more than one file. I was thinking if there's some kind of "devices" attribute (not because I need a specific device or anything) that I can define and tell krpano what include to open?, something like:

Quellcode

1
2
3
<include url="tour_eng.xml" lang="eng"/>
<include url="tour_esp.xml" lang="esp"/>
<include url="tour_fra.xml" lang="fra"/>


And depending on the lang attribute (which I would define on a separate intro xml) have one of these loaded?

I know normally I would have to do this through an if action, I just wondered if it could be done like this.

Cheers!

Tuur

Erleuchteter

Beiträge: 3 839

Wohnort: Netherlands

Beruf: Krpano custom coding / Virtual Tours / Photography / Musician / Recording engineer

  • Nachricht senden

2

Donnerstag, 11. September 2014, 18:51

i used to give the user a language choice. set(_lang, english); for example.
Then i do if(_lang == english, set(layer[x].html, data:html_info_english)); etc etc..
now you need just to make a <data> thing for every language..

The rest of the interface like showtext etc you could do the same way or like if but then ...layer[x].html, get(blabla));

works for me.

Tuur *thumbsup*

3

Donnerstag, 11. September 2014, 19:39

I would propose no IF solution where you have e.g. separate xml for all languages and just using one lang_var read data depending on what value is set.

Quellcode

1
2
3
4
5
6
7
8
9
10
11
<group name="en">
	<group name="object_1" value="something eng"	/>
	<group name="object_2" value="something eng" 	/>
	<group name="object_3" value="something eng"	/>
</group>

<group name="de">
	<group name="object_1" value="something de" />
	<group name="object_2" value="something de" />
	<group name="object_3" value="something de" />	
</group>


somewhere you have to set what is active language: set(lang_var,en);

Accesing data with: get(group[get(lang_var)].group[object_2].value);

You can see code example in multilang side menu plugin: here you can donwload and explore

Tuur

Erleuchteter

Beiträge: 3 839

Wohnort: Netherlands

Beruf: Krpano custom coding / Virtual Tours / Photography / Musician / Recording engineer

  • Nachricht senden

4

Donnerstag, 11. September 2014, 20:04

Yes that is also possible. I use that as well sometimes.. But at the end it is the same, and sort of the same amount of code, i suppose.

Tuur *thumbsup*

5

Donnerstag, 11. September 2014, 21:46

In both cases we need to have texts defined and will occupy certain amount of memory for it but when it comes to question should we use 10 IF in case we have 10 languages than proposal should be obvious.
Not to have:
if(_lang == english, set(layer[x].html, data:html_info_english));
if(_lang == deutch, set(layer[x].html, data:html_info_deutch));
.
.
.
if(_lang == italian, set(layer[x].html, data:html_info_italian));

for each attribute you have multilingual dependent can be only one:
e.g. set(layer[x].html,get(data[get(lang_var)].html.value);

I think this is also easier for Krpano engine when IF statements are optimized as much as possible. At least I try to avoid /reduce them if possible.

Tuur

Erleuchteter

Beiträge: 3 839

Wohnort: Netherlands

Beruf: Krpano custom coding / Virtual Tours / Photography / Musician / Recording engineer

  • Nachricht senden

6

Donnerstag, 11. September 2014, 22:38

mmm i suppose you are right..
i call actually the action 'english' where things are set..
Tuur *thumbsup*