Jump to content

[SOLVED] php mulilanguage reference help


darksniperx

Recommended Posts

I have talked to few people and they said that php 4 has a function to handle multi language support. From what I heard you define a test file for each language and php grabs the text. I have try to search the web and this form and with no luck. Would anyone be able to point me to the right direction, or link to a tutorial.

 

thx..

Link to comment
https://forums.phpfreaks.com/topic/76725-solved-php-mulilanguage-reference-help/
Share on other sites

Got every sentance in a variable like

$lang['sentance1'] = 'Hello My Fellow People Of The World!'

(In file called English.php)

$lang['sentance1'] = 'Здравствуйте Уважаемые соотечественники человек в мире!';

(In file called Russian.php)

Now you call the variable like

 

echo $lang['sentance1'];

and at the top of your page you have

include_once('Russian.php'); For the Russian Language

include_once('English.php'); For the English Language

 

And you do sessions and cookies and stuff to determine which language file to use based on user input!

pohoje mnogo russko govorashih na forume. If I understand correctly then the code would look something like this->

 

<!--index.php?lang=en -->
<?php
$language = $_GET['lang'];
include_once 'lang_' .$language. '.php';
?>
<html>
<head></head>
<body>
<!-- top of the webpage header -->
<?php echo $lang['header']; ?>
<hr />
<form method='post'>
<?php echo $lang['user']; ?><input type='text' name='user_id' /><br />
<?php echo $lang['pass']; ?><input type='password name='pass_id' /><br />
<input type='button' value='<?php echo $lang['submit_button']; ?>'/>
</form>
</body
</html>

 

<!-- lang_en.php -->
<?php
$lang['header']='Welcome to my site!';
$lang['user']='Username:'; 
$lang['pass']='Password:'; 
$lang['submit_button']='Submit';
?>

 

if I am correct then the code should look something like this?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.