again
(Nagy Ervin)
August 14, 2012, 8:48am
1
Hi Everyone!
I use the i18N language library in my Yii project.
I made 3 language file over the messages folder fr/fr.php,en/en.php,de/de.php
If i select a language for example “fr” , how i can get the content of fr.php’s array.
$selectedLanguage = get the selected language array’s content.
sorry for my language.
riemann
(Zendyani)
August 14, 2012, 10:28am
2
Hi Ervin,
By using Yii::t() and you can find documentation about it in
topics.i18n
You can also search in the wiki, you’ll find what you want i think.
good luck with next.
abennouna
(Abennouna)
August 14, 2012, 12:36pm
3
I made 3 language file over the messages folder fr/fr.php,en/en.php,de/de.php
If i select a language for example “fr” , how i can get the content of fr.php’s array.
Hi there
I don’t say what you’ve done is wrong, but one standard way is to have the same file name under you ‘fr’, ‘en’ and ‘de’ folders, let’s say it’s ‘translations’, ok?
Then you simply use
echo Yii::t('translations', Yii::app()->language);
Also, if you want an easy and efficient way to handle your languages in your urls and user sessions, you can see this wiki