kalessil / yii2inspections

MIT License
31 stars 3 forks source link

[dev] Usage of non-English in Yii::t() #6

Closed samdark closed 7 years ago

samdark commented 7 years ago

It is recommended to use either English or ASCII keys as translation sources. Usage of any characters out of ASCII range will cause translation problems later.

Yii::t('user', 'Hello!'); // correct
Yii::t('user', 'hell-o'); // correct
Yii::t('user', 'Привет!'); // incorrect
brandonkelly commented 7 years ago

@samdark Is that due to a PHP array key limitation?

samdark commented 7 years ago

No. http://www.yiiframework.com/doc-2.0/guide-tutorial-i18n.html#configuration:

The default value for the source language is en-US, meaning US English. It is recommended that you keep this default value unchanged. Usually it is much easier to find people who can translate from "English to other languages" than from "non-English to non-English".

brandonkelly commented 7 years ago

@samdark Ah, right, just translation process complications, not technical ones :)

samdark commented 7 years ago

Yes.

kalessil commented 7 years ago

Should it be highlighted as a weak warning, warning or an error?

samdark commented 7 years ago

Weak warning should be enough. Technically it works w/ any language as source.

kalessil commented 7 years ago

Added, can be deactivated in options.