Hi to everyone
I want to use Yii translate system for large text so,
I don’t want to translate like that
Yii:t('filename','a very large text .... so large...');
but i want to use an identifier like that
But with this approach the translate works only in other languages except the native language
(obviusly the Yii translate system recognize the identify as a normal text)
So how to achieve that?
protected/messages/en/filename.php with code
return array('myidentify.1'=>'the large text');
protected/messages/el/filename.php with code
return array('myidentify.1'=>'ένα μεγάλο κείμενο');
Thanks in advance
you could set ‘native language’ to something none-existent, like ‘xx’. then all languages will be translated using this identifiers (and you should use identifiers everywhere)
Thanks redguy for the tricks
Is there way to do by that more "robust" way or this is the best way?
Is there way by parameter for t() function, like
if not exist then I will implement it by set the native language to none-existent as the redguy suggest
After of 6 months, I wondered again, if there is a robust and easy way to do that
so, I searched in tranlate yii files and Ι detected the forceTranslation attribute
so I had to set it to true
in protected/config/main.php I added in components region the below code
'components' => array(
'messages' => array(
'forceTranslation' => true
Now, it is not nessesary to make trick to translate large text
nice find thanks for the tip.
Not sure what the problem is with setting sourceLanguage to something non-existent, it’s explained in this wiki article and works great
Thank for your post
I used this way for a long time (set sourceLanguage to non-existent) but seems to me something like trick!
Lets explain that in few words:
"if the text not found in the no-existent source language then translate it in current language"
I don’t know, it seems like trick and I used to avoid tricks as it is possible!