Elxis CMS Forum

Support => Elxis 2008 developers guide => Topic started by: datahell on January 18, 2008, 19:23:34

Title: Users Preferable Language
Post by: datahell on January 18, 2008, 19:23:34
UPL (Users Preferable Language) feature allows you to switch to any language at runtime internally and independent from the current selected by the visitor language. We can switch to an unlimited number of languages or go back to a previous loaded one. This way you can send, for example, e-mails in the recipient's preferable language and not anymore in the current language selected by the visitor who is triggering the procedure! One more unique Elxis feature.

General usage:
Code: (php) [Select]
<?php 
$prlang 
= new prefLang();
$prlang->load($lang1);
echo 
$prlang->lng->STRING
//switch language
$prlang->load($lang2);
echo 
$prlang->lng->STRING;
?>

Where $lang1, $lang2, ... can be any Elxis language name (i.e. english, greek, german etc)

Real Example:

Code: (php) [Select]
<?php 
$prlang 
= new prefLang();

$prlang->load(&#39;english&#39;);
echo &#39;Comments in English: &#39;.$prlang->lng->_E_COMMENTS; // Comments in English: Comments
$prlang->load(&#39;greek&#39;);
echo &#39;Comments in Greek: &#39;.$prlang->lng->_E_COMMENTS; // Comments in Greek: Σχόλια
$prlang->load(&#39;russian&#39;);
echo &#39;Comments in Russian: &#39;.$prlang->lng->_E_COMMENTS; // Comments in Russian: Комментарии
?>

This feature in available in Elxis 2008.0 [Olympus] rev1850+ (not available in 2008.0 DEV version)
Title: Re: Users Preferable Language
Post by: Ivan Trebješanin on January 18, 2008, 19:29:29
I already see enormous potential!!!  :D