testwebap
│ ├── assets
│ ├── css
│ ├── images
│ ├── index.php
│ ├── index-test.php
│ ├── protected
│ └── themes
详细目录结构如下
├── assets
├── css
│ ├── bg.gif
│ ├── form.css
│ ├── ie.css
│ ├── main.css
│ ├── print.css
│ └── screen.css
├── images
├── index.php
├── index-test.php
├── protected
│ ├── commands
│ │ └── shell
│ ├── components
│ │ ├── Controller.php
│ │ └── UserIdentity.php
│ ├── config
│ │ ├── console.php
│ │ ├── main.php
│ │ └── test.php
│ ├── controllers
│ │ └── SiteController.php
│ ├── data
│ │ ├── schema.mysql.sql
│ │ ├── schema.sqlite.sql
│ │ └── testdrive.db
│ ├── extensions
│ ├── messages
│ ├── migrations
│ ├── models
│ │ ├── ContactForm.php
│ │ └── LoginForm.php
│ ├── runtime
│ ├── tests
│ │ ├── bootstrap.php
│ │ ├── fixtures
│ │ ├── functional
│ │ │ └── SiteTest.php
│ │ ├── phpunit.xml
│ │ ├── report
│ │ ├── unit
│ │ └── WebTestCase.php
│ ├── views
│ │ ├── layouts
│ │ │ ├── column1.php
│ │ │ ├── column2.php
│ │ │ └── main.php
│ │ └── site
│ │ ├── contact.php
│ │ ├── error.php
│ │ ├── index.php
│ │ ├── login.php
│ │ └── pages
│ │ └── about.php
│ ├── yiic
│ ├── yiic.bat
│ └── yiic.php
└── themes
└── classic
└── views
├── layouts
├── site
└── system
通过浏览器查看一下
具体功能后面讲。这里直接讲命令的使用。
2.php yiic messag
php yiic help message打印message命令的相关用法
/* USAGE yiic message <config-file> DESCRIPTION This command searches for messages to be translated in the specified source files and compiles them into PHP arrays as message source. PARAMETERS * config-file: required, the path of the configuration file. You can find an example in framework/messages/config.php. The file can be placed anywhere and must be a valid PHP script which returns an array of name-value pairs. Each name-value pair represents a configuration option. The following options are available: - sourcePath: string, root directory of all source files. - messagePath: string, root directory containing message translations. - languages: array, list of language codes that the extracted messages should be translated to. For example, array('zh_cn','en_au'). - fileTypes: array, a list of file extensions (e.g. 'php', 'xml'). Only the files whose extension name can be found in this list will be processed. If empty, all files will be processed. - exclude: array, a list of directory and file exclusions. Each exclusion can be either a name or a path. If a file or directory name or path matches the exclusion, it will not be copied. For example, an exclusion of '.svn' will exclude all files and directories whose name is '.svn'. And an exclusion of '/a/b' will exclude file or directory 'sourcePath/a/b'. - translator: the name of the function for translating messages. Defaults to 'Yii::t'. This is used as a mark to find messages to be translated. - overwrite: if message file must be overwritten with the merged messages. */
主要用于webapp的国际化。
例如将上面生产的testwebap的
?r=site/login
登录页面的Username和Password 翻译成中文
上面说需要配置文件。yii为我们提供了配置文件的模板。
framework/messages/config.php
复制framework\messages\config.php 文件到 protected\messages\下
具体内容修改如下: