Jump to content
php.lv forumi

Recommended Posts

Posted (edited)

Es zinu ka uz pa6taisitas lapas var uzlikt vairakas valodas (un tas izveleties Lv,eng,Ru.....).....

 

piemers ir aptuveni ta :

 

ka uztaisa papku valodas tur uztaisit failus kadas valodas gribi piemeram lat.lang eng.lang rus.lang vai kautka ta

Piemeram tajos failos ieraksta

 (<.News.> "jaunumi";

Ta butu lat.lang faila

 (<.News.> "news";

Ta butu eng.lang faila

 

un piemeram taja faila kur gribi redzet izmainas ieraksti

<h3><.News.></h3>

 

Un tad weba kautkur var izveleties kadas valodas gribi Lv,eng,Ru.....

 

Bet man vaig vai kads zin ka izdarit lai parmestu uz tam valodam kad uzpiez Lv,eng,Ru.....

 

Butu labi ja kadam butu kads piemers ka un ka tajos lang failos butu jadara

Edited by goma smile
Posted

Es tur biju pet isti nevareju saptrast varetu pateikt kodu uz

 

lang faila

un faila kur ir vajadziga tulkosana

un to lai kad uzpiez lv vai rus atvras sava valoda

Posted

Man personīgi strādā ar sesijām:

<?php
if(isset($_REQUEST['set_lang'])){
if($_REQUEST['set_lang'] == "lv" OR $_REQUEST['set_lang'] == "en" OR $_REQUEST['set_lang'] == "ru"){
//$_SESSION['lang'] = $_REQUEST['set_lang'];
// setcookie("nwd_lang",$_REQUEST['set_lang']);
$_SESSION['valoda'] = $_REQUEST['set_lang'];
header ("Location: http://eip.wc3.lv");
//echo "<meta http-equiv=refresh content='0;url=".$_SERVER['PHP_SELF'].">";
}
}
//$_SESSION['lang']

switch($_SESSION['valoda']){
case 'en':
//latvieshu valoda, ja izveeleeta
include("valodas/en.php");
break;
case 'ru':
//krievu valoda, ja izveleta
include("valodas/ru.php");
break;
default:
//galvenaa valoda
include("valodas/lv.php");
break;
}
?>

Posted

Nu ta es ieks faila index.php ierkakstu ko gribu kas tulkojas

 

<?php echo $web_lang['Jaunumi'];?>

 

Un iek6 tiem en.php...... ierakstu

$web_lang['Jaunumi'] = "News";

 

tad es ieraktsu

http://nosaukums.oo.lv/index.php?set_lang=en

 

un tad ma paradas

 

Warning: Cannot modify header information - headers already sent by (output started at C:\AppServ\www\index.php:7) in C:\AppServ\www\index.php on line 322

Posted
<?php
if(!$_SESSION["mana_valoda"]) $_SESSION["mana_valoda"] = "lv";
if($_GET["v"]) $_SESSION["mana_valoda"] = $_GET["v"];
define("VALODA", $_SESSION["mana_valoda"]);

include("valodas_fails/".VALODA."/valoda.lng); // Piemeram..

echo "<a href='?v=rus'>$txt[001]</a> | <a href='?v=lv'>$txt[02]</a>";
echo "<p>-> ".VALODA;
?>

×
×
  • Create New...