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 sea开发者_高级运维rch 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?
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/
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
I would use Wikepedia's approach: Different URLs for different languages. http://en.wikipedia.org for english http://es.wikipedia.org for Spanish
精彩评论