O'Reilly logo

Yii2 By Example by Fabrizio Caldarelli

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

File-based translations

This is the most simple way to translate text messages from one language to another. Basically, there are one or more files for each language containing keywords with text representations; we will put these keywords in the source code where the framework will replace them with text.

The pairs of keyword-text translations are grouped by categories representing the filenames where they are stored. These pairs are array keys-values, where key indicates keywords, and value indicates text translations.

By default, the path folder containing translations for a specific language is in @app/messages/<language>/<category>.php. Therefore, if we are writing translations for the app category and the en-US language, for example, the complete ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required