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
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!

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.   Restore formatting

  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.

×
×
  • 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.