Get language from template -(UDT, small hack)
Posted: Sun Mar 01, 2009 10:40 pm
Hi,
I use standard CMSMS for my multilingual sites. Here is my way to set a language for modules in template:
a) Make a hack in file lib/classes/module_support/modlang.inc.php at line 53 (or near) (CMSMS 1.5.2)
replace line
with this
b) create UDT named kalba:
and place a code in page templates for e.g. lithuanian pages - {kalba kalba='lt_LT'} , for russian pages - {kalba kalba='ru_RU'} and so on.
c) In templates of modules e.g SelfRegistration, you can use the following syntax:
More info on this topic is coming
Vilkis
I use standard CMSMS for my multilingual sites. Here is my way to set a language for modules in template:
a) Make a hack in file lib/classes/module_support/modlang.inc.php at line 53 (or near) (CMSMS 1.5.2)
replace line
Code: Select all
if ($modinstance->curlang == '' && isset($gCms->current_language))
Code: Select all
if (isset($gCms->current_language))
Code: Select all
global $gCms;
global $smarty;
if( isset($params['kalba']) && $params['kalba'] != '' )
{
$gCms->current_language=$params['kalba'];
$smarty->assign('lang',$params['kalba']);
}
c) In templates of modules e.g SelfRegistration, you can use the following syntax:
Code: Select all
{if $lang eq lt_LT}
Text in lithuanian
{elseif $lang eq ru_RU}
Text in russian
{else}
Text in english
{/if}
More info on this topic is coming
Vilkis