SPHPlayground API
SPHPlayground
sphplayground sphplayground

Localization

BASIC INFORMATION:

Internationalization i18n is the process of designing a software application so that it can be adapted to various languages and regions without engineering changes. Localization l10n is the process of adapting internationalized software for a specific region or language by translating text and adding locale-specific components. [1]

This framework comes with buildin English to Finnish translations:

Translations search engine

Locale Manager

Warning:

The locale information is almost always maintained per process, not per thread. If PHP runs on a multithreaded server API, there might be sudden changes in locale settings while a script is running, though the script itself never called setlocale(). This happens due to other scripts calling setlocale() in different threads of the same process at the same time. [2]

On Windows, locale information is maintained per thread as of PHP 7.0.5.[3]

Human language translations

The Translator is the base interface for human language translation related operations. It supports both basic and plural Gettext style translation.

A translator without any translations will do nothing but return all messages verbatim.

A Translator implementation supports both basic and plural Gettext style translation. It has also a method similar to PHP's native vsprintf() function for both basic and plural translations. Additionally the class contain a method for translating a multidimensional array containing singular translatable message strings (plural form is not supported).

A Gettext object translates given input by using PHP's build in gettext extension.