![]() |
VOOZH | about |
Internationalization extension (further is referred as Intl) is a wrapper for » ICU library, enabling PHP programmers to perform various locale-aware operations including but not limited to formatting, transliteration, encoding conversion, calendar operations, » UCA-conformant collation, locating text boundaries and working with locale identifiers, timezones and graphemes.
It tends to closely follow ICU APIs, so that people having experience working with ICU in either C/C++ or Java could easily use the PHP API. Also, this way ICU documentation would be useful to understand various ICU functions.
Intl consists of several modules, each of them exposes the corresponding ICU API:
The intl extension is very useful, but it is quite low-level. In practice, using it directly can become verbose, especially for common localisation tasks that require combining multiple ICU classes and options.
For many applications, it can be helpful to use a higher-level interface on top of ext-intl. An example of such a package is Cosmo:
https://cosmo.miloun.com/?lang=php
It provides a more practical API for common tasks such as formatting numbers, money, percentages, dates, units, plurals, lists, and locale names, while still being based on ICU / intl.