FLP-i18n is a PHP class software that enables internationalization for web applications.
i18n works independently from PHP's setlocale function, but it's important to start and end your scripts with ob_start(); session_start(); and ob_end_flush(); to avoid any issues. Once you have set up your pages correctly, you can start using the package.
The language class is an excellent place to start. Its purpose is to determine the preferred locale of the user by looking at the HTTP_ACCEPT_LANGUAGE header and the user's IP address. Creating a new object is simple; you just include('class.Language.inc.php'); and $lg = new Language();. From there, you can get your information using the various methods provided. For example, if the user has set their browser to "German – Austria" (de-at), you can use $lg->getLocale() to output de_at (the hyphen is replaced with an underscore), $lg->getLang() to output de, and $lg->getCountry() to output at. The package also allows you to get all locales, all languages, or all countries with the getUserRawArray(), getUserLangArray(), and getUserCountryArray() methods, respectively.
Of course, there are situations where the user hasn't set any specific country code, or no locale information could be found. In these cases, the default settings come into play. These are defined in the i18n_settings.ini file and can be retrieved using $lg->getDefaultLocale(), $lg->getDefaultLanguage(), and $lg->getDefaultCountry(). The i18n_settings.ini file allows you to customize many settings besides the default values, including the method for getting the translations, the extensions for the translation files, the database connection settings, and whether or not translation errors should be shown.
Finally, if you need to force a specific locale to override all other locale sources, you can use $lg_gb = new Language('en_gb'). With all these features, i18n is an excellent choice for anyone looking to manage multilanguage webpages effectively.
Version 2.1b2: N/A