Support > Elxis 2008 developers guide

Users Preferable Language

(1/1)

datahell:
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) ---<?php 
$prlang = new prefLang();
$prlang->load($lang1);
echo $prlang->lng->STRING; 
//switch language
$prlang->load($lang2);
echo $prlang->lng->STRING;
?>
--- End code ---

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

Real Example:


--- Code: (php) ---<?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: Комментарии
?>
--- End code ---

This feature in available in Elxis 2008.0 [Olympus] rev1850+ (not available in 2008.0 DEV version)

Ivan Trebješanin:
I already see enormous potential!!!  :D

Navigation

[0] Message Index

Go to full version