Table of Contents
As you already know, Web:Extend provides you with translation functions directly in the core of the framework. You also know that we recommend using the intl PHP extension to internationalize your application. This set of tools is pretty much all you need to make your application available to any culture.
However, we felt the need to provide you with another class. A task someone must do often when writing an international application is select the locale to use. This can be based off the browser's HTTP headers or on the URL that was entered. This class helps you by automatically detecting both and choosing the correct language. The class can be used as an application driver, which means it can be auto started with each request and will do its job without you having to worry about it.
To enable the use of this class as an application driver, and start it automatically, simply put the following in your configuration file:
start.locale = 1 locale.driver = weeLocale locale.auto = 1 locale.default = en_US
This will also select the locale according to the HTTP headers, if possible. Otherwise the default locale will be set using locale_set_default.
This class will try to determine the locale by itself when you give a two letter language code.
For example, if you give fr to any of the following method,
it will use the locale fr_FR. If you give en it will use en_US.
You can extend the number of accepted languages simply by extending weeLocale
and adding values to the $aLocaleMap property.
About 30 different languages are defined currently.
If an important language is missing, please report it.