Variable for languages?

Hello,



does anyone in here know what variable is used to detect a language? I am talking about variable for language and NOT using language variables.



For example:



if ($language=English) {

do.this();

}



?

It is set in the cart during initialization.

It is a constant called CART_LANGUAGE and in the admin area, it is either CART_LANGUAGE or DESCR_SL when editing things in other languages.



At init time, first thing is it's set to whatever the default language is for your cart. Usually 'en' (V4) or 'EN' (earlier than V4).



Then it looks for an SL parameter and uses the language specified with that. I.e. YourStore | Search Engine Optimization For eCommerce Brands.



If no SL, then it looks in the user's session and uses a language variable that might be set there.



If all of that still doesn't result in any language change, then it looks at what the browser has requested (if anything).



So what you really want is:


if( CART_LANGUAGE == 'en' )
do_this();
}

Excellent! Thanks for the help! Will try it tomorrow! :)

uhm, tbirnseth, what syntax should I use exactly in cscart? I tried using it inside but it's not working…?



edit: just some extra info, I am trying to use this code inside the .tpl files.



I also tried the smarty way:



{if CART_LANGUAGE == 'en' }



hello



{/if}



but still no luck.

Please try
{if $smarty.const.CART_LANGUAGE == 'en'}
hello
{/if}






Valentin

[color=#808080][size=2]part of hungryweb.net[/size][/color]

@val - The example he gave was php code which is what I gave back to him and the tags he used indicate also that he's using php versus trying this inside the template.



If the OP could specify “didn't work” then it might help. I gave him a V4 use of language codes and if he's not running V4 then all he probably needs to do is change 'en' to 'EN'.

tbirnseth,



sorry if I caused any inconvenience, I didn't mean to.

or ```php


{if $smarty.const.CART_LANGUAGE|lower == ‘en’}

hello

{/if}