Page 1 of 1

$lang within Smarty [SOLVED]

Posted: Sat Dec 19, 2009 8:12 pm
by antosha
Hello,

I'm currently working with CTLModuleMaker and I'm trying to make the module I created, work with MLE.

So on my website I have three languages English (en), French (fr), and Russian(ru)

With the module I have created with the modulemaker, i have the following tags  (Tour Description for every language)
$item->tourdescen  
$item->tourdescfr
$item->tourdescru


What I want to do is that depending on which site language the user is currently on, the correct description will show.
I tried this :

{$item->tourdesc$lang}

but it doesn't work, gives me a error.

Some help would be appreciated.
Thanks :)

Re: $lang within Smarty

Posted: Sun Dec 20, 2009 12:51 am
by antosha
I think I might have found something...

Code: Select all

{if $lang ==fr}{$item->tourdescfr}{else}
{if $lang ==ru}{$item->tourdescru}{else}
{if $lang ==en}{$item->tourdescen}{/if}{/if}{/if}
Now there is no more smarty error, but the text is still not showing.

Re: $lang within Smarty

Posted: Sun Dec 20, 2009 1:57 am
by antosha
I'm sorry,
After some time spent on testing I found that the problem comes from the module itself. For some reason, when I call the module in a page, everything comes off blank.

I'll try to find an answer in forums about plugins.

Thanks.

Re: $lang within Smarty

Posted: Sun Dec 20, 2009 5:51 am
by antosha
Ok this looks like I'm talking to myself, but I solved the problem.

After i did a content dump, I realized languages are not being printed as en,fr,ru but as en_US, fr_FR, ru_RU.  ::)

So I write this in my template :

Code: Select all

{if $lang =="en_US"}{$labels->guideddescen}{else}
{if $lang =="fr_FR"}{$labels->guideddescfr}{else}
{if $lang =="ru_RU"}{$labels->guideddescru}{/if}{/if}{/if}

Sorry for spamming your forums  :P