Multilingual pages with PHP

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

Post Reply
User avatar
Sindarin
Forum Regular
Posts: 521
Joined: Tue Sep 25, 2007 8:36 am
Location: Greece

Multilingual pages with PHP

Post by Sindarin »

I was planning of making my CMS and frontend of a website multilingual. I've thought of using a variable in the url like &lang=en
I used a session variable to keep this setting. The header script gets the variable from the session and loads a list of constants.
Is it a good method? is there any other method? How does this affect search engines?
User avatar
Darhazer
DevNet Resident
Posts: 1011
Joined: Thu May 14, 2009 3:00 pm
Location: HellCity, Bulgaria

Re: Multilingual pages with PHP

Post by Darhazer »

do not use session - the url have to include the language. What will happen if I share the URL which do not contain the lang code. My friends will see it in the default language instead of the one we're using.
And it's not good for SEO

it's best to use URLs like domain.com/lang-code/rest-of-the-url
User avatar
Jonah Bron
DevNet Master
Posts: 2764
Joined: Thu Mar 15, 2007 6:28 pm
Location: Redding, California

Re: Multilingual pages with PHP

Post by Jonah Bron »

Don't forget about $_SERVER['HTTP_ACCEPT_LANGUAGE'].
Kurby
Forum Commoner
Posts: 63
Joined: Tue Feb 23, 2010 10:51 am

Re: Multilingual pages with PHP

Post by Kurby »

I believe Smarty is pretty good at multilingual support.
User avatar
MindOverBody
Forum Commoner
Posts: 96
Joined: Fri Aug 06, 2010 9:01 pm
Location: Osijek, Croatia

Re: Multilingual pages with PHP

Post by MindOverBody »

Use Zend_Translate
Post Reply