115 lines
3.0 KiB
PHP
Executable File
115 lines
3.0 KiB
PHP
Executable File
<?php
|
|
|
|
/**------------------------------------------------
|
|
*
|
|
* Rooty, 2018 <rooty@rooty.me>
|
|
*
|
|
*
|
|
* This software is protected by copyright, please
|
|
* read the file COPYRIGHT.
|
|
* This program is distributed in the hope that it
|
|
* will be useful, but without any warranty; without
|
|
* even the implied warranty of merchantability or
|
|
* fitness for a particular purpose. Please
|
|
* read the file LICENCE.
|
|
*
|
|
* Fichier check_lang.php
|
|
*
|
|
* Ce fichier permet la vérification de la langue de l'utilisateur lors de l'installation
|
|
*
|
|
* @author Initiance <www.initiance.com|martial@initiance.com>
|
|
* @link www.rooty.me
|
|
* @since 2018/04/02
|
|
* @version 0.3
|
|
* @package install
|
|
* @copyright Copyright © 2009-2018, Rooty
|
|
* @docreview Tristan <tristan@initiance.com> | 30-10-2005
|
|
*/
|
|
|
|
/**
|
|
*
|
|
*/
|
|
function check_lang($filelang="")
|
|
{
|
|
global $QWARE_ROOT_PATH, $_SERVER;
|
|
|
|
// The order here _is_ important, at least for major_minor
|
|
// matches. Don't go moving these around without checking with
|
|
// me first - psoTFX
|
|
$match_lang = array(
|
|
'ar' => 'ar([_-][a-z]+)?',
|
|
'bg' => 'bg',
|
|
'ca' => 'ca',
|
|
'cs' => 'cs',
|
|
'da' => 'da',
|
|
'de' => 'de([_-][a-z]+)?',
|
|
'gb' => 'en([_-][a-z]+)?',
|
|
'et' => 'et',
|
|
'fi' => 'fi',
|
|
'fr_FR-utf8' => 'fr_FR-utf8',
|
|
'fr' => 'fr([_-][a-z]+)?',
|
|
'el' => 'el',
|
|
'es-ar' => 'es[_-]ar',
|
|
'es' => 'es([_-][a-z]+)?',
|
|
'gd' => 'gd',
|
|
'gl' => 'gl',
|
|
'gu' => 'gu',
|
|
'he' => 'he',
|
|
'hi' => 'hi',
|
|
'hr' => 'hr',
|
|
'hu' => 'hu',
|
|
'is' => 'is',
|
|
'id' => 'id([_-][a-z]+)?',
|
|
'it' => 'it([_-][a-z]+)?',
|
|
'ja' => 'ja([_-][a-z]+)?',
|
|
'ko' => 'ko([_-][a-z]+)?',
|
|
'lv' => 'lv',
|
|
'lt' => 'lt',
|
|
'mk' => 'mk',
|
|
'nl' => 'nl([_-][a-z]+)?',
|
|
'no' => 'no',
|
|
'pa' => 'pa',
|
|
'pl' => 'pl',
|
|
'pt-br' => 'pt[_-]br',
|
|
'pt' => 'pt([_-][a-z]+)?',
|
|
'ro' => 'ro([_-][a-z]+)?',
|
|
'ru' => 'ru([_-][a-z]+)?',
|
|
'sl' => 'sl([_-][a-z]+)?',
|
|
'sq' => 'sq',
|
|
'sr' => 'sr([_-][a-z]+)?',
|
|
'sv' => 'sv([_-][a-z]+)?',
|
|
'sv' => 'sv([_-][a-z]+)?',
|
|
'th' => 'th([_-][a-z]+)?',
|
|
'tr' => 'tr([_-][a-z]+)?',
|
|
'uk' => 'uk([_-][a-z]+)?',
|
|
'ur' => 'ur',
|
|
'vi' => 'vi',
|
|
'zh-tw' => 'zh[_-]tw',
|
|
'zh' => 'zh',
|
|
'gb' => 'us',
|
|
);
|
|
|
|
if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE']))
|
|
{
|
|
// $accept_lang_array = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']);
|
|
// for ($i = 0; $i < sizeof($accept_lang_array); $i++)
|
|
// {
|
|
// @reset($match_lang);
|
|
// foreach($match_lang as $lang => $match)
|
|
// {
|
|
// if (preg_match('#' . $match . '#i', trim($accept_lang_array[$i])))
|
|
// {
|
|
// if (file_exists(($QWARE_ROOT_PATH . 'data/message/' . $lang."/".$filetest)))
|
|
if (file_exists(($QWARE_ROOT_PATH . "data/message/fr_FR-utf8/".$filelang)))
|
|
{
|
|
// return $lang."/";
|
|
return "fr_FR-utf8/";
|
|
}
|
|
// }
|
|
// }
|
|
// }
|
|
}
|
|
return 'FR';
|
|
}
|
|
?>
|