NegantsLV_ Posted April 3, 2010 Report Share Posted April 3, 2010 Tagat tulkoju mājas lapu uz trim valodām. Esmu jau iztulkojis index.php failu. Vai kāds neprot un nevarētu man palīdzēt uzstādīt šis valodas, lai virs headera būtu karodziņi un uzspiežot uz tiem nomainās mājas lapas valoda. Quote Link to comment Share on other sites More sharing options...
chizijs Posted April 3, 2010 Report Share Posted April 3, 2010 <?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"); ?> Quote Link to comment Share on other sites More sharing options...
sandis_m Posted April 3, 2010 Report Share Posted April 3, 2010 nav kkā dīvaini ar to 'define' visu laiku ? :D Quote Link to comment Share on other sites More sharing options...
chizijs Posted April 3, 2010 Report Share Posted April 3, 2010 Tavs variants? Quote Link to comment Share on other sites More sharing options...
sandis_m Posted April 3, 2010 Report Share Posted April 3, 2010 (edited) 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 April 3, 2010 by who_i_am Quote Link to comment Share on other sites More sharing options...
waplet Posted April 3, 2010 Report Share Posted April 3, 2010 un ja aizmirsīsi ,kuram kurš cipars? Quote Link to comment Share on other sites More sharing options...
sandis_m Posted April 3, 2010 Report Share Posted April 3, 2010 un ja aizmirsīsi ,kuram kurš cipars? Var jau arī nerakstīt ciparus. Quote Link to comment Share on other sites More sharing options...
chizijs Posted April 3, 2010 Report Share Posted April 3, 2010 (edited) Un ja uzspiež uz visām valodām būs 3vienādi teksti ar dažadām valodam? ^^ Edited April 3, 2010 by chizijs Quote Link to comment Share on other sites More sharing options...
sandis_m Posted April 3, 2010 Report Share Posted April 3, 2010 (edited) Un ja uzspiež uz visām valodām būs 3vienādi teksti ar dažadām valodam? ^^ Nē. vai tad? nē taču Edited April 3, 2010 by who_i_am Quote Link to comment Share on other sites More sharing options...
chizijs Posted April 3, 2010 Report Share Posted April 3, 2010 (edited) 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 April 3, 2010 by chizijs Quote Link to comment Share on other sites More sharing options...
sandis_m Posted April 3, 2010 Report Share Posted April 3, 2010 (edited) Man viss ir ok. EDIT: nu nez. var jau definēt cik grib un aizdefinēties. :D man vienalga Edited April 3, 2010 by who_i_am Quote Link to comment Share on other sites More sharing options...
chizijs Posted April 3, 2010 Report Share Posted April 3, 2010 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'];?> Quote Link to comment Share on other sites More sharing options...
NegantsLV_ Posted April 3, 2010 Author Report Share Posted April 3, 2010 (edited) Man kaut kas tur nestrādā vai pareizi nevaru uzstādīt. INDEX.php Varat kāds pateikt kurā rindā jāliek tas KODS, un kāds precīzi. Edited April 3, 2010 by NegantsLV_ Quote Link to comment Share on other sites More sharing options...
chizijs Posted April 3, 2010 Report Share Posted April 3, 2010 (edited) Man kaut kas tur nestrādā vai pareizi nevaru uzstādīt. INDEX.php Varat kāds pateikt kurā rindā jāliek tas KODS, un kāds precīzi. Pašā augšā Edited April 3, 2010 by chizijs Quote Link to comment Share on other sites More sharing options...
NegantsLV_ Posted April 3, 2010 Author Report Share Posted April 3, 2010 meiģināju, bet errors izmetās. Nevarat kāds parādīt kā izstīsies tas SCRIPTS? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.