| | |
Multiple languages site?
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
hello all..
Tel me how to create a site with different languages, if user select particular language, then all the content will be displayed in that language...
How to do it???
or
Any predefined free software available on the internet...
Any resources or information would be appreciated....
Thanks..
Shanti.
Tel me how to create a site with different languages, if user select particular language, then all the content will be displayed in that language...
How to do it???
or
Any predefined free software available on the internet...
Any resources or information would be appreciated....
Thanks..
Shanti.
Be intelligent, But Don't try to cheat.. Be innocent But Don't get cheated..
•
•
Join Date: Oct 2007
Posts: 38
Reputation:
Solved Threads: 1
I would normally just create a PHP file of definitions... name it after the language and include the correct file...
that way your code will never have to change and it's kept simple... i guess the only problem would be including variables... but depending on the type of site you have it may or not be a problem
if you needed variables within your output text I would then consider setting up a languages table in a database setup something like
ref | lang | output
then make a function called display() that would be called like
which would be defined like
and welcome in the db would look like
ref | lang | output
welcome | en | Hi $var1, how the hell are you
this code is scribbled and i wouldn't use it, just to give you a rough idea.
that way your code will never have to change and it's kept simple... i guess the only problem would be including variables... but depending on the type of site you have it may or not be a problem
if you needed variables within your output text I would then consider setting up a languages table in a database setup something like
ref | lang | output
then make a function called display() that would be called like
PHP Syntax (Toggle Plain Text)
echo display('welcome');
PHP Syntax (Toggle Plain Text)
function display($ref, $var1) { global $lang; $info = mysql_fetch_array(mysql_query("select from languages where lang='$lang' and ref='$ref'")); $output = preg_replace($info['output']); // find out the regex to pickup and convert variables return $output; }
ref | lang | output
welcome | en | Hi $var1, how the hell are you
this code is scribbled and i wouldn't use it, just to give you a rough idea.
![]() |
Similar Threads
- Looking for web developers in Delaware (Web Development Job Offers)
- Russian/Asian brides dating site promotion (Promotion and Marketing Plans)
- "Forbidden / You don't have permission to access / on this server." error (Linux Servers and Apache)
- site no.of visitors improving PHP (PHP)
- Need help for a paper (IT Professionals' Lounge)
- cPanel Special: Buy 1 Month & Get Your Next Month FREE by AllureHost.com (Web Hosting Deals)
- another newbie with alot of redhat and apache server Q'S (Linux Servers and Apache)
- a few search engine optimization questions (Search Engine Optimization)
Other Threads in the PHP Forum
- Previous Thread: how to display calendar through php in html table
- Next Thread: Multiple files Upload plz HelP
| Thread Tools | Search this Thread |
# .htaccess 5.2.10 access alexa apache api array beginner broken cakephp checkbox class clean clients cms code convert cron curl database date directory display dissertation dropdown dynamic echo$_get[x]changingitintovariable... email encode error fairness file folder form forms function functions google hack href htaccess html htmlspecialchars image include indentedsubcategory ip javascript joomla legislation limit link local login mail memberships menu methods multiple multipletables mysql mysqlquery network newsletters oop open passwords paypal pdf persist php provider query radio random redirect remote script search secure server sessions simple sockets source space spam sql system table tutorial upload url user variable video voteup web youtube






