Yii is translated in many languages in order to be useful for international applications and developers. Two main areas where contribution is very welcome are documentation and framework messages.
The framework has two types of messages: exceptions that are intended to developer and are never translated and messages that are actually visible to the end user such as validation errors.
In order to start with message translation:
framework/messages/config.php
and make sure your language is listed in languages
. If not,
add your language there (remember to keep the list in alphabetical order). The format of language code
should follow IETF language tag spec, for example,
ru
, zh-CN
.framework
and run ./yii message/extract @yii/messages/config.php --languages=<your_language>
.framework/messages/your_language/yii.php
. Make sure file is saved using UTF-8 encoding.In order to keep your translation up to date you may run ./yii message/extract @yii/messages/config.php --languages=<your_language>
again. It will
automatically re-extract messages keeping unchanged ones intact.
In the translation file each array element represents the translation (value) of a message (key). If the value is empty, the message is considered as not translated. Messages that no longer need translation will have their translations enclosed between a pair of '@@' marks. Message string can be used with plural forms format. Check i18n section of the guide for details.
Put documentation translations under docs/<original>-<language>
where <original>
is the original documentation name
such as guide
or internals
and <language>
is the language code of the language docs are translated to. For the
Russian guide translation it is docs/guide-ru
.
After initial work is done you can get what's changed since last translation of the file using a special command from
build
directory:
php build translation "../docs/guide" "../docs/guide-ru" "Russian guide translation report" > report_guide_ru.html
If it will complain about composer, perform composer install
in the source root dir.
For information on the documentation syntax and style guide, see documentation_style_guide.md.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。