Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Archive /

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, biapar, Willr, Ingo, simon_w

Switching languages. How to make the allocation of the current language?


Reply


5 Posts   1419 Views

Avatar
WebSpilka

Community Member, 83 Posts

5 June 2008 at 11:24pm

Edited: 05/06/2008 11:29pm

How to make the allocation of the current language?
In Page.ss I have next code

<div id="LangBar">
<a href="./?lang=ru">РУССКИЙ</a> <a href="./?lang=en">ENGLISH</a>
</div>

How I can use Session::get('currentLang'); in Page.ss

in HTML code i wont get next

<div id="LangBar">
<a href="./?lang=ru" class="Selected">РУССКИЙ</a> <a href="./?lang=en">ENGLISH</a>
</div>

Avatar
fdqepd

Community Member, 8 Posts

26 August 2008 at 11:11am

hi, have you found a way of getting th current language?
bye

Avatar
WebSpilka

Community Member, 83 Posts

26 August 2008 at 6:02pm

no ((

Avatar
Willr

Forum Moderator, 5513 Posts

26 August 2008 at 7:34pm

You can get the current language in your php by using - Translatable::current_lang() . If you need it from the template I think you will need to create a function in your PHP code and call it from your template.

in mysite/code/Page.php in the Page_Controller class

function CurrentLang() {
return Translatable::current_lang();
}

Then in your template you can use $CurrentLang, tho I would assume there is some built in method for this...

Avatar
fdqepd

Community Member, 8 Posts

26 August 2008 at 11:58pm

great willr thnks!!