Pages: [1]
  Print  
Author Topic: localizing page title  (Read 264 times)
arne
Gaia User
**
Posts: 34



« on: July 04, 2011, 08:55:28 AM »

hi guys

I m using the ramiro's multilingual MOD on a 2 languages website

At the very end of the development the client ask me to localize the navigator page title
and i don't know how to do without changing everything (i could play with 2 site.xml but don't have the time)

all my pages have a <title-fr> and a <title-en> node, example:


 <page id="petiteshistoires" title="Les petites histoires de la maison" src="petiteshistoires.swf" menu="true">
                 <title-fr><![CDATA[Les petites histoires <br/>de la maison]]></title-fr>
               <title-en><![CDATA[Tales from the House]]></title-en>
</page>


is it possible to pass those titles to the window title? do you have an idea??

thx alot

arne


Logged
Ramiro
Moderator
Gaia Addict
*****
Posts: 861


interactive pragmatism


« Reply #1 on: July 04, 2011, 10:38:50 AM »

1. in the localization xmls place an extra node for the title, with type "property".
2. in each page create a public setter with the name of the id you set in the xml, and call Gaia.api.setTitle with the passed value.

That's it. If you need it for Every page, place the code in the AbstractLocalePage.

The property + setter approach let's you do virtually anything. If you check the downloadable example, in the OtherPage there's the setter approach being used.
Logged
arne
Gaia User
**
Posts: 34



« Reply #2 on: July 04, 2011, 10:49:25 AM »

coool trick!!
thank you so much!
Logged
Ramiro
Moderator
Gaia Addict
*****
Posts: 861


interactive pragmatism


« Reply #3 on: July 04, 2011, 10:51:13 AM »

you could also get the custom node you've made from the site.xml, but it's better to keep all the localization data and logic in their current places.
Logged
arne
Gaia User
**
Posts: 34



« Reply #4 on: July 04, 2011, 10:55:03 AM »

aa?

and how could i? (i don't have so much time - if i can do it faster - it's better)
Logged
Ramiro
Moderator
Gaia Addict
*****
Posts: 861


interactive pragmatism


« Reply #5 on: July 04, 2011, 11:04:12 AM »

I think it would be faster my way:

in each localization xml
Code:
<loc id="title" type="property">Your title</loc>

in each page with the title localization:
Code:
public function set title(value:String):void
{
Gaia.api.setTitle(value);
}
Logged
arne
Gaia User
**
Posts: 34



« Reply #6 on: July 04, 2011, 11:36:45 AM »

you're right.

thanx again
Logged
Pages: [1]
  Print  
 
Jump to:  

TinyPortal v1.0 beta 4 © Bloc