PHP Classes

File: Lang_panel.php

Recommend this page to a friend!
  Classes of Alexander Eist   PHP Multilanguage Site Script   Lang_panel.php   Download  
File: Lang_panel.php
Role: Application script
Content type: text/plain
Description: UI language panel for php/html page
Class: PHP Multilanguage Site Script
Allow users to select the site text language
Author: By
Last change:
Date: 1 year ago
Size: 2,924 bytes
 

Contents

Class file image Download
<?php
define
('ru','ru'); //ru
define('ee','ee'); // ?????????
define ('lv','lv'); //??????????
define ('lt','lt'); //?????????
define('md','md'); //??????????
define('ua','ua'); // ??????????
define ('by','by'); //??????????
define ('ge','ge'); //??????????
define ('ar','ar'); //
define ('az','az'); //
define ('kr','kr'); //??????????
define('uz','uz'); // ?????????
define('kz','kz'); //?????????
define ('td','td'); // ??????????
define ('tm','tm'); // ???????????
define('cn','cn'); // ?????????
define('cz','cz');
define('de','de');
define('it','it');
define('fr','fr');
define('tk','tk');
define('en','en');
define('jp','jp');
define('vn','vn');
//--------------const default-------------------------------|
define ('DEFAULT_LANG', cz);
 
$langs= array(ru,ua,cz, en, kz,tt,ge,lv,lt,uz, it, jp, cn,tk,fr, vn, tm ,td); // array_intersect(array array1, array array2, [array ...])
 
$lang_title=array(
                  
ua => '???????????',
                  
tt => '?????????',
                  
lt => 'Litva',
                  
lv => 'Latvia',
                  
uz => 'Uzbekistan',
                  
ru => '???????',
                  
ge => '???????',
                  
by => '???????????',
                  
en => 'English',
                  
de => 'Deutch',
                  
cn => 'China',
                  
cz => '?esky',
                  
ee => 'Estony',
                  
it => 'Italian',
                  
fr => 'France',
                  
jp => 'Japan',
                  
vn => 'Vietnam',
                  
tu => 'Turkmenistan',
                  
tk => 'Tadgikistan',
                  
kz => '???????'
 
);
//if(array_key_exists('lng', $_REQUEST)&&(strlen($_REQUEST['lng']>=2))&&(@sizeof( @array_intersect($langs, $_REQUEST)==1))) {$lng= $_REQUEST['lng']; }else{ $lng=ru;} // array_key_exists(mixed key, array search)



//////////////////////////////////////////////
$lng = (array_key_exists('lng' , $_REQUEST))? $_REQUEST['lng']:DEFAULT_LANG;
$r='<div style="margin-top:0px">';
if(
array_key_exists("show_lang_panel",$_REQUEST)) {
 foreach(
$langs as $key=>$value){
   
$r .= '<a href="?lng='.$value.'"><img src="flags/'.$value.'.png" class="flags" title ="' .
          
$lang_title[$value].'"></a>&nbsp;';
    }

 } else{
 
$r.='<a href="?lng='. $lng .'&amp;show_lang_panel=1">
          <img src="./flags/'
. $lng.'.png" class="flags" title ="Current language is ' .$lang_title[$lng].'. Click to change language ">
       </a>'
;
 }

 
$r .='</div>';
    echo (
$r);

 
////////////////////////////////
 
 
?>