dportabella
asked on
multilanguage site in PHP
We currently have a web site written in (simple) PHP.
We would need to add the multilanguage feature,
that is, that the user can select in which language to view the website.
What would be the best way to implement this?
without changing too much our current PHP code.
Many thanks,
DAvid
We would need to add the multilanguage feature,
that is, that the user can select in which language to view the website.
What would be the best way to implement this?
without changing too much our current PHP code.
Many thanks,
DAvid
If the site isn' t that big, you could also use a language file,i.e. english.php, german.php, each one containing the text (in each language) you want in variables. In your code you just have to use the proper variables, depending in the user's language selection. I would prefer using XML to do that, but it might require a bit more programming work...
Bakos
Bakos
ASKER
Hello,
Thanks for the comments.
I guess that we are not the only ones with that need,
and we would prefer to use a standard approach.
We would prefer not using a sql database.
Defining variables (in separate php files or xml files) would be nice, but still a little cumbersome.
We would really like to have everything (the php code + the text in the different languages) all together in the same php files.
Do you know of full simple concrete implementation examples that we can look at?
Many thanks,
DAvid
Thanks for the comments.
I guess that we are not the only ones with that need,
and we would prefer to use a standard approach.
We would prefer not using a sql database.
Defining variables (in separate php files or xml files) would be nice, but still a little cumbersome.
We would really like to have everything (the php code + the text in the different languages) all together in the same php files.
Do you know of full simple concrete implementation examples that we can look at?
Many thanks,
DAvid
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
It is a smart idea to have a table for english as well (your default language). Then when the user visits, retrieve the english values from the database. Make all your title, menutext, browser heading, etc.... as variables that are replaceable in terms of which language you have to retrieve from the database.
Hope this is an understandable explanation.