I am interested to know is there a script or otherway available to collect and generate Yii translation messages in a controller/project
Eg. If I have the following code
I could give you input how to start and you can write your own script. I found this good for me for now :)
public function missing($messageEvent) {
Yii::log(
"'".$messageEvent->message."' => '',",
'translation',
$messageEvent->category.'.'.$messageEvent->language
);
}
}
'components' => array(
//...
'log' => array(
array(
'class'=>'CFileLogRoute',
'levels'=>'translation',
'logFile'=>'translations.log',
),
//...
),
'messages' => array(
//'class' => 'CDbMessageSource',
'onMissingTranslation' => array('Translation', 'missing'),
//'sourceMessageTable' => 'source_message',
//'translatedMessageTable' => 'message'
),
)
You will end up with translation.php
file in your log file directory and file contents will be something like:
2012/06/28 09:45:00 [translation] [Site.lv] 'MyStringInSource' => '',
....
depending on your configuration.
So you can copy 'MyStringInSource' => '',
part and put in corresponding translation file.
This is helpful in development process because it will grow translation.log file with missing translation (repeatedly) until you translate these.
Hope it gives you idea.