Multilingual web applications keep interface messages in separate, easy-to-edit files that are loaded during the execution depending on the selected user language. Programmers can choose from several different implementation or write their own one. Unfortunately, while they allow just to translate the messages, they often ignore many cultural and language-specific aspects. Personally, I’m not surprised. Until now, PHP did not have any reliable internationalization mechanism, and implementing a good one from scratch is a significant design challenge. However, everything has changed in PHP 5.3 which introduced the INTL extension which is a port of International Components for Unicode library. In this post, I would like to describe one of the extension classes,
MessageFormatter which provides an advanced l10n message formatting.