Yii multi-language settings
In this document, perform the following operations on a windows operating system:
First open the DOS interface and copy the message system configuration file (framework/messages/config. php by default) to the protected/messages Directory of the project:
?
| 1 |
Copy G: \ www \ yii \ framework \ messages \ config. php G: \ www \ yii \ abc \ protected \ messages \ config. php |
Enter the text in the view:
?
| 123 |
EchoYii: t ('fontend', 'My name? '); EchoYii: t ('fontend', 'My age? '); EchoYii: t ('fontend', 'My gender? '); |
Open protected/messages/config. php and modify:
?
| 12 |
'Ages '=> array ('zh _ cn', 'zh _ tw', 'De', 'El', 'El', 'sv', 'hes ', 'nl ', 'pt', 'pt _ br', 'Ru ', 'it', 'Fr', 'Ja ', 'Pl', 'Hu ', 'ro', 'id', 'VI', 'bg ', 'lv', 'SK', 'uk', 'Ko _ kr', 'KK ', 'CS '), for 'ages' => array ('zh _ cn', 'zh _ tw ', 'en'), // The language you want |
Enter the DOS interface, enter the framework directory, and then enter the following command:
?
| 1 |
Yiic message ../abc/protected/messages/config. php |
The system automatically generates a language file and then modifies it.
Set the default language and modify protected/config/main. php:
Add the following to the array: 'language '=> 'zh _ cn ',