function load(k_Context $context) { require_once 'PEAR.php'; require_once 'HTTP.php'; if ($context->query('lang') == 'da') { return new DanishLanguage(); } else { if ($context->query('lang') == 'fr') { return new FrenchLanguage(); } else { if ($context->query('lang') == 'de') { return new GermanLanguage(); } else { if ($context->query('lang') == 'hi') { return new HindiLanguage(); } else { if ($context->query('lang')) { return new DanishLanguage(); } } } } } $supported = array("da" => true, "en-US" => true); $language = HTTP::negotiateLanguage($supported); if (PEAR::isError($language)) { // fallback language in case of unable to negotiate return new DanishLanguage(); } if ($language == 'en-US') { return new EnglishLanguage(); } return new DanishLanguage(); }
function load(k_Context $context) { if ($context->query('lang') == 'sv') { return new SwedishLanguage(); } else { if ($context->query('lang') == 'en') { return new EnglishLanguage(); } } return new EnglishLanguage(); }
/** * @param string * @param mixed The default value to return, if the value doesn't exist * @return string */ function get($key, $default = null) { return isset($this->state[$this->namespace . $key]) ? $this->state[$this->namespace . $key] : $this->context->query($this->namespace . $key, $default); }