Link to home
Start Free TrialLog in
Avatar of Karen Liddy
Karen LiddyFlag for Ireland

asked on

PHP Language translation for website

Hi there,
I have a property listing site, i want to be able to change the languages of the site via a button without having to rewrite the whole site again.
Can anyone tell me how this would be done or of any good tutorials for it.  I searched google, phpfreaks, etc, but couldn´t find much

Kind regards,

MsKazza
Avatar of blue_hunter
blue_hunter
Flag of Malaysia image

you need server side language transition or client side language transition?

client side script transition would need to involve javascripts
you would need to have session, query string or parameter to trigger the changes of the languages.


example:

$_GET["lang"] = "en";




if(!empty($_GET["lang"])){
switch($_GET["lang"]){
case "en":
$type = "English words";
break;
case "cn":
$type = "Chinese Words";
break;
}
}


you may check out how "XAMPP" work out from http://www.apachefriends.org/en/xampp.html
Avatar of stuartc1
stuartc1

Sometimes the best thing to do is use one that already exists and is well tested.

For example google language tool or babelfish - you can create a link on your pages which passed the UR and desired language to one of these third party sites. These sites then transform the language and display it for the user.
Avatar of Karen Liddy

ASKER

Thanks for those replies.

I have seen in places (for e.g. ZenCart) when the page references and external txt file that has the translations already done.  And the page inserts the translated words or paragraphs depending on the values called on the page.

How could this be done using PHP?

Thanks for the links, but non of them had quite what i was looking for.  I want people to be able to add additional languages when and if needed simply by adding the txt file with the translated words, and adding the command on the index page.

The site i'm working on is a property listing site that real estate agents will buy and then go adding modules on to it, including one for language, but i want them to be able to either purchase additional languages or translate them themselves.  So it needs to be really easy, hence the external translated file.

Thanks for help

MsKazza
ASKER CERTIFIED SOLUTION
Avatar of dr_dedo
dr_dedo
Flag of Egypt image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
thank you.  i think that will be the easiest way to do it, and then just have form to insert the paragraphs into the database when they want to add another language.

one last question.  on the index page where i´ll be putting the flag to switch language, i would use this command?
lang=en (english flag)
lang=es (spanish flag)
lang=ge (german flag)

or something along those lines.

thanks