/** * Sets the locale if it exists in the session or uses preferred or default locale * * @return void */ public function configureLocale() { $defaultLocale = static::getDefaultLocale(); // set fallback locale \App('translator')->setFallback($defaultLocale); // set main locale \Request::setDefaultLocale($defaultLocale); $sessionKey = static::getLocaleSessionKey(); $preferredLocale = \Request::getPreferredLanguage(static::getAllowedLocales()); \App::setLocale($sessionKey ? \Session::get($sessionKey, $preferredLocale) : $preferredLocale); }
<?php require '../../../init_wiki.php'; session_start(); Request::initParam('p', 'string'); if (!isset($_SESSION['language'])) { $_SESSION['language'] = Request::getPreferredLanguage(); } if (file_exists(TRANS_DIR . TRANS_FILE_PREFIX . $_SESSION['language'] . '.php')) { include TRANS_DIR . TRANS_FILE_PREFIX . $_SESSION['language'] . '.php'; } else { include TRANS_DIR . TRANS_FILE_PREFIX . 'en.php'; } ?> <!DOCTYPE HTML> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title><?php echo TransT(1); ?> </title> <link rel='stylesheet' href='css/wiki.css' type='text/css'> </head> <body> <table width="100%"> <tr> <td style="padding-right: 15px"> <?php if (isset($_PARAMS['p'])) {