Chapter 10. Localize the App

This chapter explains how to write a multilingual app. Localization, also known as Internationalization (I18N), takes care that a software application can be adapted and rendered in different languages without changes in the source code. This is particularly important in a web application where users speak different languages.

Yii provides powerful tools to handle this task, choosing from the file or database approach (according to the application's complexity). We will cover the following topics:

  • Setting the default language
  • File-based translations
    • Example – using file-based translation for the entire website
  • Placeholders formatting
  • DB-based translations
    • Example – translating the room's description using DB

Setting the default ...

Get Yii2 By Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.