wood burning stoves*
The moose likes JSP and the fly likes Dual language website with data from db Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Dual language website with data from db" Watch "Dual language website with data from db" New topic
Author

Dual language website with data from db

Kristian Breifossmo
Greenhorn

Joined: Mar 01, 2005
Posts: 9
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.


Any ideas anyone?


<ul type="square"><br /><li><a href="http://kb.zapto.org/Kristian/sd_index.jsp" target="_blank" rel="nofollow">Kristian Breifossmos hjemmeside</a><br /> <br /><li><a href="http://kb.zapto.org/Marthe/sd_index.jsp" target="_blank" rel="nofollow">Marthe Buseths hjemmeside</a><br /></ul>
Kristian Breifossmo
Greenhorn

Joined: Mar 01, 2005
Posts: 9
Since I didn't want to have separate .jsp files for each language I decided
to pass the change of language to the calling page itself.

Such as this:

page.jsp?language=en


The spider will (hopefully) treat the pages "page.jsp?language=en", "page.jsp" and "page.jsp?language=no" as different pages and thus indexing all of them.

I'm not a webspider expert so I wouldn't know for sure. I remember reading something about some spiders not indexing urls with "?" and "&"


Any comments on this approach?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Dual language website with data from db