BrighteyesDesign
asked on
Multi Language Website - Best way with PHP + MySQL
I am about the build a multi language website using PHP + MySQL.
It's for a real estate website and the translations will be manually interpreted (rather than automated like Google translate).
I am really looking for the most efficient way of creating this site.
I'm guessing i'll need a database table per language: one in english, one in spanish and one in french.
Would I then need 3 duplicate sites/directories? Is there a better way to do this?
It's for a real estate website and the translations will be manually interpreted (rather than automated like Google translate).
I am really looking for the most efficient way of creating this site.
I'm guessing i'll need a database table per language: one in english, one in spanish and one in french.
Would I then need 3 duplicate sites/directories? Is there a better way to do this?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
But why bother to mask a URL? Why not allow clients to send a link that tells the true URL? It just feels more user-friendly to me that way.
ASKER
Thanks for your help,
With the PHP.net method what would be in the root directory? If the default language is english would the root index.php redirect to /en/index.php
Also, with the drop down that selects the different languages. I guess this redirects the user to uURL's along the lines of...
http://us.php.net/manual/en/(code to detect the current pages filename)
http://us.php.net/manual/es/(code to detect the current pages filename) etc...
With the PHP.net method what would be in the root directory? If the default language is english would the root index.php redirect to /en/index.php
Also, with the drop down that selects the different languages. I guess this redirects the user to uURL's along the lines of...
http://us.php.net/manual/en/(code to detect the current pages filename)
http://us.php.net/manual/es/(code to detect the current pages filename) etc...
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Re figuring out the lang based on IP is problematic. What is someone is a native Spanish speaker but they are travelling in Montreal, Quebec and they are accessing the site from a netbook?
Even in the US, you can't assume English just because it is a US-based IP. In some parts of L.A. even the roadside ads are in Spanish because the majority of the people who live in that area speak Spanish.
Even in the US, you can't assume English just because it is a US-based IP. In some parts of L.A. even the roadside ads are in Spanish because the majority of the people who live in that area speak Spanish.
http://us.php.net/manual/en/function.var-dump.php
http://us.php.net/manual/es/function.var-dump.php
http://us.php.net/manual/fr/function.var-dump.php
http://us.php.net/manual/kr/function.var-dump.php
You might also want to let the client choose the language. You can cookie the browser to remember the last choice. This is a better strategy than trying to detect the client's IP address and choosing the language based on the IP. Whether I was in Paris or Madrid, I would still prefer to use English.