add localization and move timezone selection to the right place
This commit is contained in:
parent
5badc9f0cd
commit
379328434b
15 changed files with 141 additions and 13 deletions
|
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue