Page 1 of 1

Using different Title fields for different languages

Posted: Mon May 18, 2009 12:34 pm
by fgrace
Hi all
I'm quite new to CMSMS so please bare with me...i would be grateful for any help on this..

I am setting up a multilingual site with English as the main language and swedish, spanish etc. as secondary languages.
I wish to use the Description (title attribute) for the Titles on English pages, while using the main Title for all pages in other languages, how can this be achieved ?
e.g. If english then display description tag else display Main title

My template code looks like this:

{process_pagedata}



{title}
{* The sitename is changed in Site Admin/Global settings. {title} is the name of each page *}

{metadata}
{* Don't remove this! Metadata is entered in Site Admin/Global settings. *}



{global_content name='lang-stylesheet'}
{literal}

Re: Using different Title fields for different languages

Posted: Mon May 18, 2009 12:43 pm
by Jean le Chauve
{if $lang="en_EN"}{description}{else}{title}{/if}
edit : of course ==  ;D

Re: Using different Title fields for different languages

Posted: Mon May 18, 2009 10:26 pm
by fgrace
Hi Jean

Thanks for your response. I tried the code you gave me, and although it appears to produce the correct title in the code..the page loaded with the following error:
string(114) "Smarty error: [in template:24 line 5]: syntax error: unidentified token '=' (Smarty_Compiler.class.php, line 1407)"
and the page design loaded incorrectly

Re: Using different Title fields for different languages

Posted: Tue May 19, 2009 7:52 am
by vilkis
Hi,
try this:

Code: Select all

{if $lang eq "en_EN"}<title>{description}</title>{else}<title>{title}</title>{/if}
or

Code: Select all

{if $lang=="en_EN"}<title>{description}</title>{else}<title>{title}</title>{/if}
vilkis

Re: Using different Title fields for different languages

Posted: Tue May 19, 2009 10:07 am
by alby
fgrace wrote: I am setting up a multilingual site with English as the main language and swedish, spanish etc. as secondary languages.
I wish to use the Description (title attribute) for the Titles on English pages, while using the main Title for all pages in other languages, how can this be achieved ?
e.g. If english then display description tag else display Main title
fgrace, next time provide more informations (MLE for example) and appropriate forum

fgrace, if you want a description for english ONLY (because you have 1 description only), use vilkis advice
if you want description for other languages (two or more) you must set MLE extended version (look for README.FIRST.extended file)

Alby

Re: Using different Title fields for different languages

Posted: Mon May 25, 2009 11:08 pm
by fgrace
Hi

@vilkis - Your code worked perfect (using "en_US" language)
Thanks to all contributors for the information

regards
FG