Yii2生成翻译消息

In Yii 1.x we generated translation messages with command ./framework/yiic message protected/messages/config.php How can we achieve the same with Yii2?

Just run using yiic file in root directory of your project (where composer.json is). Here is help from the yiic. If you have specific problem let me know.

./yii help message

DESCRIPTION

Extracts messages to be translated from source files.

The extracted messages can be saved the following depending on format setting in config file:

  • PHP message source files.
  • ".po" files.
  • Database.

Usage: 1. Create a configuration file using the 'message/config' command: yii message/config /path/to/myapp/messages/config.php 2. Edit the created config file, adjusting it for your web application needs. 3. Run the 'message/extract' command, using created config: yii message /path/to/myapp/messages/config.php

SUB-COMMANDS

  • message/config: Creates a configuration file for the "extract" command.
  • message/extract (default): Extracts messages to be translated from source c...

To see the detailed information about individual sub-commands, enter:

yii help