I have decided to try to convert my personal website into a multilanguage website using a database for storing the content. I will display the content in norwegian and english and currently the selection of language is done with a session value.
The session value is set to english if it doesn't exit (default english).
When a user changes the language the appropriate content should be displayed.
The problem; Consider this scenario:
I have a jsp that handles changing language (setting session variable to preferred language), when someone clicks on "change language" that jsp is run and control is returned to the referring page (which now displays the content in a different language).
Why it could fail: * A search engine decides to spider one of my pages. * The session for the spider is initiated with english as the default language. * When spidering a page, it stumbles upon a link for changing language. * It stores that link with the other links on that page that it will spider later. * When the page has been spidered, the spider continues with the other links . * One of these links is the "change language"-link. * The spider tries to spider the page which changes selected language. * This page changes language and returns control to the referring page sending the spider to the referring page. * The spider does not spider this page again, since it has already been done, causing the alternative language content not to become indexed.
Do you see the problem?
In short -> A search engine will at most index my pages using only one language per page.
Using separate .jsp files for each language is not an option.