Pau G.P.
Pau G.P.

Reputation: 11

Get language in a tpl file

I want to write a code in different languages ​​using an

if (language = en || lenguage=es) {// code } (For example)

in a tpl file. How can I know what language the user is using?

Thanks!

Upvotes: 0

Views: 5864

Answers (3)

Masiorama
Masiorama

Reputation: 1117

In Prestashop 1.7 it seems that the correct way to read the iso code of the current language is

{$language.iso_code}

To find out all the properties of the object:

{$language|@var_dump}

Upvotes: 1

Matteo Enna
Matteo Enna

Reputation: 1301

To print the language i uses:

{$cookie->id_lang}

You could use:

{if $cookie->id_lang == '<id_language>'} {/if}

Upvotes: 0

sadlyblue
sadlyblue

Reputation: 2987

In front office use the lang_iso variable:

{if $lang_iso == 'en'}code{/if}

Upvotes: 1

Related Questions