Vladimir Keleshev
Vladimir Keleshev

Reputation: 14245

How to pass language information from page to page?

If I have a multilingual site, what is the best way to pass information about language?

Right now the language is saved in cookies. That's convenient except that might be not good for search optimization, if search bots don't use cookies.

The other option would be specifying language in address, like exampel.com/?lang=de, but then you probably need to add ?lang=xx to every link on the page.

Is there a right way?

Upvotes: 0

Views: 193

Answers (3)

Jigar Joshi
Jigar Joshi

Reputation: 240890

Better way is to maintain this info in session,

The other option would be specifying language in address, like exampel.com/?lang=de, but then you probably need to add ?lang=xx to every link on the page.

Is there a right way?

I would have created filter than parse each request and fetches the lang param and process accordingly.

Moreover I would recommend you to use following url pattern, and get the lang from filter

yourapp.com/en/welcome/

Upvotes: 2

Nivas
Nivas

Reputation: 18334

I would use Wikepedia's approach: Different URLs for different languages. http://en.wikipedia.org for english http://es.wikipedia.org for Spanish

Upvotes: 1

JohnP
JohnP

Reputation: 50019

If you want all the content crawlable then you'd have to pass it in the URL. Either as a parameter http://mydomain.com/en/english-content or maybe have separate sites/subdomains http://english.mydomain.com/english-content

Upvotes: 1

Related Questions