Jump to content
php.lv forumi

Valodas


NegantsLV_

Recommended Posts

<?php
session_start();
if(isset($_GET['lv'])){
unset($_SESSION['lang']);
$_SESSION['lang'] = "lv";
}
elseif(isset($_GET['en'])){
unset($_SESSION['lang']);
$_SESSION['lang'] = "en";
}
elseif(isset($_GET['ru'])){
unset($_SESSION['lang']);
$_SESSION['lang'] = "ru";
}
else{
$_SESSION['lang'] = "lv";
}
include_once("/lang/".$_SESSION['lang'].".php");
print"".home."";
echo "<br/>";
print"".tavi_teksti."";

ru.php, lv.php, en.php

<?php
define("home","Māja");
define("tavi_teksti","Tavi teksti");
?>

Link to comment
Share on other sites

 Grūti forumā sameklēt . 

 

Šito kodu tepat arī kkur atradu:

 

 

 

 

<?php
session_start();
if(empty($_SESSION['site_lang'])){
  //
$_SESSION['site_lang']="lv";
}else{
$lang = $_SESSION['site_lang'];
$l = $lang_arr[$lang];
}

if($_GET['lang']){
    if($_GET['lang']=="lv"){$_SESSION['site_lang']="lv";}
    if($_GET['lang']=="en"){$_SESSION['site_lang']="en";}
    if($_GET['lang']=="ru"){$_SESSION['site_lang']="ru";}
}
//languages EN LV



 $lang_arr['en']['1'] = "Home";
$lang_arr['lv']['1'] = "Mājas";

$lang_arr['lv']['2'] = "Cits";

$lang_arr['en']['2'] = "Other";

?>

 

 

 

 

 

Un tad attiecīgi <?php echo $l[1''];?>

Edited by who_i_am
Link to comment
Share on other sites

Būs 3 session [lv, en, ru]

if($_GET['lang']){
   if($_GET['lang']=="lv"){$_SESSION['site_lang']="lv";}
   if($_GET['lang']=="en"){$_SESSION['site_lang']="en";}
   if($_GET['lang']=="ru"){$_SESSION['site_lang']="ru";}
}

ietestē pats, vismaz man ta bija

Edited by chizijs
Link to comment
Share on other sites

Mans iznākums

lv en ru

 

iznaakums

enlvru

kods

<?
session_start();
if(empty($_SESSION['site_lang'])){
$_SESSION['site_lang']="lv";
}else{
$lang = $_SESSION['site_lang'];
$l = $lang_arr[$lang];
}
if($_GET['lang']){
   if($_GET['lang']=="lv"){$_SESSION['site_lang']="lv";}
   if($_GET['lang']=="en"){$_SESSION['site_lang']="en";}
   if($_GET['lang']=="ru"){$_SESSION['site_lang']="ru";}
}
$lang_arr['en']['1'] = "Home";
$lang_arr['lv']['1'] = "Mājas";
$lang_arr['lv']['2'] = "Cits";
$lang_arr['en']['2'] = "Other";
?>
<a href="?lang=lv">lv</a> <a href="?lang=en">en</a> <a href="?lang=ru">ru</a> <br/>
iznaakums<br/>
<?=$_SESSION['site_lang'];?>

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...