[ Index ] |
|
Code source de Zen Cart E-Commerce Shopping Cart 1.3.7.1 |
1 <?php 2 // 3 // +----------------------------------------------------------------------+ 4 // |zen-cart Open Source E-commerce | 5 // +----------------------------------------------------------------------+ 6 // | Copyright (c) 2006 The zen-cart developers | 7 // | | 8 // | http://www.zen-cart.com/index.php | 9 // | | 10 // | Portions Copyright (c) 2003 osCommerce | 11 // +----------------------------------------------------------------------+ 12 // | This source file is subject to version 2.0 of the GPL license, | 13 // | that is bundled with this package in the file LICENSE, and is | 14 // | available through the world-wide-web at the following url: | 15 // | http://www.zen-cart.com/license/2_0.txt. | 16 // | If you did not receive a copy of the zen-cart license and are unable | 17 // | to obtain it through the world-wide-web, please send a note to | 18 // | license@zen-cart.com so we can mail you a copy immediately. | 19 // +----------------------------------------------------------------------+ 20 // $Id: language.php 4725 2006-10-11 09:03:27Z drbyte $ 21 // 22 23 class language { 24 var $languages, $catalog_languages, $browser_languages, $language; 25 26 function language($lng = '') { 27 global $db; 28 $this->languages = array('ar' => 'ar([-_][[:alpha:]]{2})?|arabic', 29 'bg' => 'bg|bulgarian', 30 'br' => 'pt[-_]br|brazilian portuguese', 31 'ca' => 'ca|catalan', 32 'cs' => 'cs|czech', 33 'da' => 'da|danish', 34 'de' => 'de([-_][[:alpha:]]{2})?|german', 35 'el' => 'el|greek', 36 'en' => 'en([-_][[:alpha:]]{2})?|english', 37 'es' => 'es([-_][[:alpha:]]{2})?|spanish', 38 'et' => 'et|estonian', 39 'fi' => 'fi|finnish', 40 'fr' => 'fr([-_][[:alpha:]]{2})?|french', 41 'gl' => 'gl|galician', 42 'he' => 'he|hebrew', 43 'hu' => 'hu|hungarian', 44 'id' => 'id|indonesian', 45 'it' => 'it|italian', 46 'ja' => 'ja|japanese', 47 'ko' => 'ko|korean', 48 'ka' => 'ka|georgian', 49 'lt' => 'lt|lithuanian', 50 'lv' => 'lv|latvian', 51 'nl' => 'nl([-_][[:alpha:]]{2})?|dutch', 52 'no' => 'no|norwegian', 53 'pl' => 'pl|polish', 54 'pt' => 'pt([-_][[:alpha:]]{2})?|portuguese', 55 'ro' => 'ro|romanian', 56 'ru' => 'ru|russian', 57 'sk' => 'sk|slovak', 58 'sr' => 'sr|serbian', 59 'sv' => 'sv|swedish', 60 'th' => 'th|thai', 61 'tr' => 'tr|turkish', 62 'uk' => 'uk|ukrainian', 63 'tw' => 'zh[-_]tw|chinese traditional', 64 'zh' => 'zh|chinese simplified'); 65 66 $this->catalog_languages = array(); 67 $languages = $db->Execute("select languages_id, name, code, image, directory 68 from " . TABLE_LANGUAGES . " 69 order by sort_order"); 70 71 while (!$languages->EOF) { 72 $this->catalog_languages[$languages->fields['code']] = array('id' => $languages->fields['languages_id'], 73 'name' => $languages->fields['name'], 74 'image' => $languages->fields['image'], 75 'code' => $languages->fields['code'], 76 'directory' => $languages->fields['directory']); 77 $languages->MoveNext(); 78 } 79 80 $this->browser_languages = ''; 81 $this->language = ''; 82 83 $this->set_language($lng); 84 } 85 86 function set_language($language) { 87 if ( (zen_not_null($language)) && (isset($this->catalog_languages[$language])) ) { 88 $this->language = $this->catalog_languages[$language]; 89 } else { 90 $this->language = $this->catalog_languages[DEFAULT_LANGUAGE]; 91 } 92 } 93 94 function get_browser_language() { 95 $this->browser_languages = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']); 96 97 for ($i=0, $n=sizeof($this->browser_languages); $i<$n; $i++) { 98 reset($this->languages); 99 while (list($key, $value) = each($this->languages)) { 100 if (eregi('^(' . $value . ')(;q=[0-9]\\.[0-9])?$', $this->browser_languages[$i]) && isset($this->catalog_languages[$key])) { 101 $this->language = $this->catalog_languages[$key]; 102 break 2; 103 } 104 } 105 } 106 } 107 } 108 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Mon Nov 26 16:45:43 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |