Language negotiation picks the best language available
<?php
require_once HORDE_BASE . '/lib/Lang.php'; $language = Lang::select();
// If we want to set the language cookie, pass an optional argument of true $language = Lang::select(true);
// Set up gettext putenv("LANG=$language"); @setlocale(LC_ALL, $language); bindtextdomain('application', APP_BASE . '/locale'); textdomain('application');
?>
- The browser's HTTP_ACCEPT_LANGUAGE list is compared to Horde's language list
- The first match is used
- However, if a language cookie is set, that is used instead
- If you use the Horde Registry class to handle application setup and switching,
this will all be done for you.
- You can still use the Lang:: class by itself if you need it.
|