Use multiple translators when generating translations

I’m working on an extension that can use Yii translations in javascript. I’ve stumbled across one problem: Yii uses Yii::t as translator, but in javascript I have to use Yii.t. Since the translator property of MessageCommand only accepts one translator (it’s a string) I can’t use one config to scan all my translations. The workaround is to use a separate config for JS and PHP, but then you can’t share the same translation files between PHP and JS. They would override each others translations during generation of the translations in yiic.

The simplest solution is to change the translator property from a string to an array, and make it accept multiple translations, this doesn’t break backwards compatibility and adds the feature of being able to scan multiple languages (PHP, JS, templates, etc).

Is this something worth considering? I could make a pull request for it.

Sounds like a nice feature, you can create an issue on github for it.

Done https://github.com/yiisoft/yii/issues/1228