All our applications have a standard config file which is in the always_load section of the config, and contains this (and a lot of other app config stuff). We also allow overriding the language via the query string, so developers can easily switch languages, for example to test views with different language files.
// language cookie available? if ($language = \Cookie::get('eaf_lang', false) and in_array($language, array('en', 'nl', 'fr', 'de'))) { Config::set('language', $language); }
// if not, perform browser language autodetection (for the languages we support) elseif(\Agent::accepts_language('nl')) { Config::set('language', 'nl'); } elseif(\Agent::accepts_language('fr')) { Config::set('language', 'fr'); } elseif(\Agent::accepts_language('de')) { Config::set('language', 'de'); } else { Config::set('language', 'en'); }
/** * Custom application configuration, based on the current environment */ if (Fuel::$env !== 'production') { /** * Make sure the URI is parsed, needed to populate $_GET properly for fastcgi installs */ Config::set('security.output_filter', array('Security::htmlentities')); Input::uri();
/** * Allow language overrides using the query string */ if (isset($_GET['lang']) and in_array($_GET['lang'], array('en', 'nl', 'fr', 'de'))) { $language = $_GET['lang']; Config::set('language', $language); }
/** * Allow profiling override using the query string */ Config::set('profiling', isset($_GET['profile'])); }