Ionut Flavius Pogacian
Ionut Flavius Pogacian

Reputation: 4811

Yii: How to translate app when using slugs?

I have translated my app in 2 languages;

romanian and english;

the messages folder ro_ro for romanian and en_us for english;

these are the settings for the languages

'sourceLanguage'=> 'en_us',
'language' => 'en_us',

Yes, I know that the 2 values are identical and the setting is ignored;

the tricky part is that i want to use a slug as the key when trying to translate;

Yii::t('some_table','unique_slug_something');

I don't want to use it as:

Yii::t('table_x','My Favorites');

So, my app is not capable of translating to en_us language;

I must use the slugs!

Upvotes: 2

Views: 111

Answers (1)

Ionut Flavius Pogacian
Ionut Flavius Pogacian

Reputation: 4811

I found my solution:

'sourceLanguage'=>'00',
'language'=>'en',

protected/messages/de/app.php
protected/messages/en/app.php
protected/messages/fr/app.php

http://www.yiiframework.com/wiki/243/how-to-translate-and-do-the-translations-the-easy-way/

Upvotes: 1

Related Questions