You are not logged in.

mstoss

Intermediate

  • "mstoss" started this thread

Posts: 297

Location: Berlin

  • Send private message

1

Monday, January 14th 2013, 11:05am

title tag localisation

Hello,

What do I want to achieve?
I try to build a multilingual tour by using the KRPano standard skin. Apart from more detailed illustrations, which I will provide, I'm fighting with setting the title tag of the scenes properly according to the chosen language.

What did I do so far?

step 1: I created an onstart event, which is calling an action, "a_setlanguage(gb);"

step 2: I created the action

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<action name="a_setlanguage">

if(%1==en,
		set(tit_01,welcome);
		set(tit_02,have a look);
		set(tit_03,good bye);
		trace(tit_02);
);

if(%1==dk,
		set(tit_01,velkommen);
		set(tit_02,se dig om);
		set(tit_03,hej hej);
		trace(tit_02);
);

</action>


(The user shall be able to select the language by changing the variable).

step 3: I wanted to edit the title tag accordingly

<scene name="scene_01" title="get(tit_01)" onstart="" thumburl="panos/01.tiles/thumb.jpg" lat="" lng="" heading="">



But all I get is a title like "Virtual Tour - get(tit_01)". Where is my mistake? Which way to go?


All help appreciated,
Michael

mstoss

Intermediate

  • "mstoss" started this thread

Posts: 297

Location: Berlin

  • Send private message

2

Wednesday, January 16th 2013, 2:04am

Any ideas what I'm doing wrong?

spacerywirtualne

Professional

Posts: 1,117

Location: Poland, Europe

Occupation: krpano developer : virtual tours : the cms4vr owner

  • Send private message

3

Wednesday, January 16th 2013, 8:31am

Hi mstoss

You can not do that in a dynamic way.

<scene name="scene_01" title="get(tit_01)" onstart="" thumburl="panos/01.tiles/thumb.jpg" lat="" lng="" heading="">

There is another way, it may not be too smart but working.

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<!-- global -->
 
<disc name="en">
  <item name="tit_01" val="welcome" />
  <item name="tit_02" val="have a look" />
  <item name="tit_03" val="good bye"  />
</disc>

<disc name="de">
  <item name="tit_01" val="velkommen" />
  <item name="tit_02" val="se dig om" />
  <item name="tit_03" val="hej hej" />
</disc>

<action name="a_setlanguage">
  trace('val :', get(disc[get(lang)].item[get(scene[%1].title)].val));
</action>

<!-- scens -->
<scene name="scene_01" title="tit_01" onstart="a_setlanguage(scene_01)" thumburl="panos/01.tiles/thumb.jpg" lat="" lng="" heading="">


You can switch languages ​​using the lang variable.

Source code

1
set(lang,de)


or

Source code

1
set(lang,en);


You can modify the code to your needs.

regards *thumbup*

Piotr
Your own professional, online cloud tool for creating virtual tours - www.cms4vr.com

facebook page :: youtube :: wiki.cms4vr.com

cms4vr team *thumbsup*

mstoss

Intermediate

  • "mstoss" started this thread

Posts: 297

Location: Berlin

  • Send private message

4

Wednesday, January 16th 2013, 2:06pm

Thank you very much Piotr,

anyhow, this seems not to do, what I need, at least not immediately.

In this way, I can produce a language version of the title tag. E.g.

<scene name="scene_01" title="tit_01" onstart="a_setlanguage(scene_01); action(activatespot,mp_01, 0);"

can be resolved to any language related value for the titel in this way, but I don't know how I can continue using the standard skin xml. There you need to refer e.g. to

"... showtext(get(scene[get(linkedscene)].title)... "

And the title remains still the same... :-(

Yours,
Michael

spacerywirtualne

Professional

Posts: 1,117

Location: Poland, Europe

Occupation: krpano developer : virtual tours : the cms4vr owner

  • Send private message

5

Wednesday, January 16th 2013, 3:05pm

maybe something like this?

Source code

1
 showtext(get(disc[get(lang)].item[get(scene[get(linkedscene)].title)].val));


*question*

regards

Piotr
Your own professional, online cloud tool for creating virtual tours - www.cms4vr.com

facebook page :: youtube :: wiki.cms4vr.com

cms4vr team *thumbsup*

mstoss

Intermediate

  • "mstoss" started this thread

Posts: 297

Location: Berlin

  • Send private message

6

Wednesday, January 16th 2013, 10:31pm

maybe something like this?

Source code

1
 showtext(get(disc[get(lang)].item[get(scene[get(linkedscene)].title)].val));


*question*

regards

Piotr

WOW... *huh*

... I will try!

mstoss

Intermediate

  • "mstoss" started this thread

Posts: 297

Location: Berlin

  • Send private message

7

Wednesday, January 23rd 2013, 11:04pm

Amazing. I did not try that item stuff before and I did not try with the actual example here yet, but I remembered your approach, when I tried to figure out a similar problem when setting onhover-events for map-hotspots. I managed to do that your way there! Tomorrow I will try the title-tag stuff then :-)

(Switching showtext according to chosen language?)

Great help already now, THANKS A LOT

edit: uuups. That was a bit too early - the hover information is not being refreshed properly.

Michael

This post has been edited 1 times, last edit by "mstoss" (Jan 23rd 2013, 11:59pm)


mstoss

Intermediate

  • "mstoss" started this thread

Posts: 297

Location: Berlin

  • Send private message

8

Sunday, February 3rd 2013, 2:27pm

Hi Piotr and all,

I used the proposed solution by Piotr with success:

First you need to define a list of the descriptions to be used in the desired languages:

Source code

1
2
3
4
5
6
7
8
9
10
11
<s_tit name="de">
  <item name="01" val="Eingang" />
  <item name="02" val="Auditorium" />
  <item name="03" val="VIP Bereich" />
</s_tit>

<s_tit name="gb">
  <item name="01" val="Auditorium Entrance" />
  <item name="02" val="Auditorium Hall" />
  <item name="03" val="VIP Hall" />
</s_tit>


then you need a variable for the language switch, in my case I called it "v_lang"
I added a custom-tag to the scenes, called "langtit", eg. <scene name="scene_01" title="Better title of scene 01" langtit="01"... >
This seems not necessary, it was only a result of my proscess and I did not want to strip it for this additional tag, once it all was running. Obviously, you can fill the name="" parameter in s_tit with e.g. "scene_01", "scene_02" etc instead.

then you locate the "skin_hotspotstyle" and edit the hover-parameter:

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
	   	onhover="
	   				if(
	   				skin_settings.tooltips_hotspots, 
	   					if(
	   					linkedscene,
	   						showtext( 
	   							         get(   s_tit[get(v_lang)].item[get(scene[get(linkedscene)].langtit)].val   )  
	   							     	,SKIN_TOOLTIPS
	   							     	);
	   				   	):
	   					
	   			    	);
	   			   	"




In the "skin_addthumbs"-action (at the end) and in the "skin_update_scene_infos"-action (at the beginning) you need to edit the code as well:

Source code

1
2
3
				showtext( get(   s_tit[get(v_lang)].item[get(scene[get(linkedscene)].langtit)].val   )  
	   								,SKIN_TOOLTIPS
	   								);    );


Source code

1
2
3
			if(title, txtadd(layer[skin_title].html, get(title), ' - ', get(scene[get(xml.scene)].title) ); , copy(layer[skin_title].html, 

		    s_tit[get(v_lang)].item[get(scene[get(xml.scene)].langtit)].val ); );