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
...