Use multiple translators when generating translations #1228

arne-s opened this Issue Aug 14, 2012 · 1 comment

3 participants

arne-s commented Aug 14, 2012

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).

Pull request is here: #1229

cebe commented Aug 16, 2012

@Arne-S you can link issues on github like this to auto create a backlink on the other side: #1229

@samdark samdark added a commit that referenced this issue Sep 8, 2012
@samdark samdark Enh #1228: Added ability to MessageCommand to generate translation fi…
…les for multiple functions
@samdark samdark was assigned Sep 8, 2012
@samdark samdark closed this Sep 8, 2012
@klimov-paul klimov-paul added a commit to klimov-paul/yii that referenced this issue Mar 22, 2013
@klimov-paul klimov-paul Unit test case for issue #1228 has been added. 1dde759
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment