Book Image

Mastering Yii

By : Charles R. Portwood ll
Book Image

Mastering Yii

By: Charles R. Portwood ll

Overview of this book

The successor of Yii Framework 1.1, Yii 2 is a complete rewrite of Yii Framework, one of the most popular PHP 5 frameworks around for making modern web applications. The update embraces the best practices and protocols established with newer versions of PHP, while still maintaining the simple, fast, and extendable behavior found in its predecessor. This book has been written to enhance your skills and knowledge with Yii Framework 2. Starting with configuration and how to initialize new projects, you’ll learn how to configure, manage, and use every aspect of Yii2 from Gii, DAO, Query Builder, Active Record, and migrations, to asset manager. You'll also discover how to automatically test your code using codeception. With this book by your side, you’ll have all the skills you need to quickly create rich modern web and console applications with Yii 2.
Table of Contents (20 chapters)
Mastering Yii
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface
5
Modules, Widgets, and Helpers
13
Debugging and Deploying
Index

The application language


Before we can start using Yii2's translation features, we need to define the application our language is written in. Application languages in Yii2 are defined by a unique ID consisting of a language ID as defined by the ISO-639 format and a region ID defined by the ISO-3166 format. As an example, en-US represents English as the spoken language in the United States of America.

Tip

Details on ISO-639 can be found at http://www.loc.gov/standards/iso639-2/, and details on IISO-3166 can be found at https://www.iso.org/obp/ui/#search.

Yii2 defines two language properties within our configuration file that we can define. The first sourceLanguage property represents the language or locale our application is written in and generally does not change during the request life cycle of our application. The second, language, represents the language or locale that our user is using, and it can be changed by the end user at any point in time (typically through the use of a language...