add localization and move timezone selection to the right place

This commit is contained in:
coderkun 2014-01-19 23:03:55 +01:00
commit 379328434b
15 changed files with 141 additions and 13 deletions

View file

@ -17,12 +17,21 @@
*
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
*/
class HtmlAgent extends \nre\agents\ToplevelAgent
class HtmlAgent extends \hhu\z\ToplevelAgent
{
protected function __construct(\nre\core\Request $request, \nre\core\Response $response, \nre\core\Logger $log=null)
{
parent::__construct($request, $response, $log);
$this->setLanguage($request);
}
/**
* Action: index.
*/
@ -32,6 +41,27 @@
$this->addSubAgent('Menu');
}
private function setLanguage(\nre\core\Request $request)
{
// Set domain
$domain = \nre\configs\AppConfig::$app['name'];
// Get language
$locale = $request->getGetParam('lang', 'language');
if(is_null($locale)) {
return;
}
// Load translation
putenv("LC_ALL=$locale");
setlocale(LC_ALL, $locale);
bindtextdomain($domain, ROOT.DS.\nre\configs\AppConfig::$dirs['locale']);
textdomain($domain);
}
}
?>