LibreY- privacy respecting meta search engine |
git clone git://git.acid.vegas/LibreY.git |
Log | Files | Refs | Archive | README | LICENSE |
localization.php (623B)
1 <?php 2 3 function printtext($key) { 4 echo TEXTS[$key]; 5 } 6 7 function printftext() { 8 $argv = func_get_args(); 9 $key = array_shift($argv); 10 vprintf(TEXTS[$key], $argv); 11 } 12 13 // default to language "en" 14 $locale = "en"; 15 16 if (array_key_exists("HTTP_ACCEPT_LANGUAGE", $_SERVER)) { 17 $accept_language_header = $_SERVER['HTTP_ACCEPT_LANGUAGE']; 18 19 foreach(explode(",", explode(";", $accept_language_header)[0]) as $header_language) { 20 if (file_exists("locale/$header_language.php")) { 21 $locale = $header_language; 22 break; 23 } 24 } 25 } 26 27 define("TEXTS", require "locale/$locale.php"); 28 ?>