10812 Posts in 2496 Topics by 1785 members
|Go to End|
13 February 2010 at 2:34am
I've got some problem with using _t() function in my multilanguage site.
In my template i put:
<% _t('DESIGN', 'some text') %>
I have 2 lang files under mysite/lang folder: en_US.php and pl_PL.php where I enter:- for en_US.php
$lang['en_US']['Page.ss']['DESIGN'] = 'some text';
and- for pl_PL.php
$lang['pl_PL']['Page.ss']['DESIGN'] = 'polish text';
Whatever language I choose in my site it always give me back 'polish text'. Its seems to work ok, but it never wants to load english text (unless I delete pl_PL.php).
In my _config.php I have:
I dont have a clue what is wrong... General content translations done in CMS admin work fine.
Any help I will be grateful.
13 February 2010 at 6:08am
In my _config.php I have some other lines:
// Define allowed locales overriding those present in i18n::$common_locales
$allowed_locales = array(
'fr_FR' => array('French', 'français'),
'en_GB' => array('English', 'English'),
'es_ES' => array('Spanish', 'español')
i18n::$common_locales = $allowed_locales;
// Define defaults
setlocale(LC_ALL, 'fr_FR.UTF8', 'fr_FR', 'fr-FR', 'french'); // Needed for dates
Also, you need to set your locale in the init() function of your Page_Controller with some code implementing i18n::set_locale(). Do you have it? (see here).
Hope it helps,
14 February 2010 at 4:29am Last edited: 14 February 2010 4:29am
Shouldn't it be:
<% _t('Page.ss.DESIGN', 'some text') %>
Or should this work regardless because page.ss is the location?
15 February 2010 at 10:16pm
Thank you for your responses.
Juanitou, ,you were right, I didnt set locale in my Page_Controller.
After adding this in my init() function:
everything is working just fine
|Go to Top|