Chapter 19. Internationalization and Localization


Though everyone who programs in PHP has to learn some English eventually to get a handle on its function names and language constructs, PHP can create applications that speak just about any language. Some applications need to be used by speakers of many different languages. Taking an application written for French speakers and making it useful for German speakers is made easier by PHP’s support for internationalization and localization.

The recipies in this chapter rely on the capabilities of PHP’s intl extension for internationalization and localization tasks. Underlying this extension is the powerful ICU library. ICU is widely used and has both C/C++ and Java implementations. This means that the concepts around working with in PHP translate well if you are doing globalization work in other (programming) languages.

The intl extension is bundled with PHP versions 5.3.0 and later. To use it with PHP 5.2.0 or later, install it from PECL.

Internationalization (often abbreviated I18N) is the process of taking an application designed for just one locale and restructuring it so that it can be used in many different locales.[7] Localization (often abbreviated L10N) is the process of adding support for a new locale to an internationalized application.[8]

A locale is a group of settings that describe text formatting and language customs in a particular area of the world. Locales describe behavior for:

How text is sorted: ...

Get PHP Cookbook, 3rd Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.