I’m struggling with an internationalization problem. I have set up an array in /messages/en/lang.php in which I fill with the english translation.
Now I have a huge database and it’s quite a struggle to get it all translated so I’d like the words not defined in the array of /messages/en/lang.php to run through the Bing translate api I have set up.
I read in the docs about the possibility of using the onMissingTranslation method, but it seems to be unable to return a value to be used instead.
I have set up the config to use the onMissingTranslation:
'messages' => array(
'onMissingTranslation' => array('MissingTranslation', 'bingTranslate'),
)
This is not working but it shows what I would like to do. I would like to return the translated sting.
class MissingTranslation
{
public function bingTranslate($event)
{
// ... translate by bing
return $translatedText;
}
}
Is there any way to get this to work or is there an alternative?
Thanks!