darksniperx Posted November 10, 2007 Share Posted November 10, 2007 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 More sharing options...
Crew-Portal Posted November 10, 2007 Share Posted November 10, 2007 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 https://forums.phpfreaks.com/topic/76725-solved-php-mulilanguage-reference-help/#findComment-388430 Share on other sites More sharing options...
Crew-Portal Posted November 10, 2007 Share Posted November 10, 2007 Also A Bonus: PHP Фреакс является Лучшие места в Интернет для всех ваших потребностей PHP! In English Means: PHPFreaks is the place on Interweb for all PHP needs! Link to comment https://forums.phpfreaks.com/topic/76725-solved-php-mulilanguage-reference-help/#findComment-388432 Share on other sites More sharing options...
darksniperx Posted November 10, 2007 Author Share Posted November 10, 2007 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 https://forums.phpfreaks.com/topic/76725-solved-php-mulilanguage-reference-help/#findComment-388606 Share on other sites More sharing options...
Crew-Portal Posted November 10, 2007 Share Posted November 10, 2007 Bingo Perfect yat thats how it would be done! Link to comment https://forums.phpfreaks.com/topic/76725-solved-php-mulilanguage-reference-help/#findComment-388646 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.