Last post Feb 18, 2008 06:32 AM by Tok Bek
Feb 15, 2008 09:25 AM|CurtWRC|LINK
I'm looking for the best method to display my website in different languages. Currently the whole site is in English, however it also needs to be in alternative languages. Can someone please suggest to me the best method to take?
So far one idea Ive had is to allow languages to be added to the database through an admin section. Then for news articles for example I could have a 'LanguageID' field so that only certain articles are displayed depending on the Language selected (which
will be stored in a cookie).
Then some pages are content managed. I currently store the content managed pages as records in a table in the database called ContentPages with the fields:
Then on the front end of the site I just query the record and display the 'Content' field.
So to allow more languages per page I was thinking of splitting the table into 2 called 'Pages' and 'PageContent'. The 'Pages' table would have all the same fields as the ContentPages table, however removing the 'Content' field. Then the 'PageContent' table
would have the fields:
Then depending on the cookie value the LanguageID can be queried and the 'Content' field displayed.
Is this a good method to take for these 2 sections so far?
The part I'm struggling with is smaller text such as on form fields where it says 'Username' or 'Click here to register' etc.. Do I make a record in the database for each bit of text on the entire site?!
Thanks for your time, your help would be most appreciated!
Feb 15, 2008 12:09 PM|Tok Bek|LINK
I think this is the right way to handle the Managed Content.
for lables and short text you should use Resource files.
Here is a very good tutorial.
Instead of using Cookie, I think its better to use UrlReWrite. e.g. www.xxx.com/en, www.xxx.com/fr
In that way :
1. you could offer your users a better way to get to the right language pages.
2. Search engines could link to the right language page and not to the default language page.
you can get a tutorial for url Reright here
Feb 18, 2008 04:24 AM|CurtWRC|LINK
Ive just finished watching the tutorial and it showed me the language can be changed from the browser pointing to different resource files. However I don't think this method will work for me. The admin needs to be able to add new countries to the site. Plus
the user needs to be able to click on a flag on the page which changes the language. Thats why I thought of the cookie idea.
Feb 18, 2008 06:32 AM|Tok Bek|LINK
Its a good thing to set the language by setting the current thread culture.
By this you will get a bulit in multilingual support for your website by Resource file and other out of the box controls.
In addition You will need to manage some logic for Images and DB content.
All the above has nothing to do with the logic that you will use set the "current thread culture".
You can let .Net decide automatically what is the browser culture, or you can set it manually.
If you need to set it manually, i think it is better to use URL ReWrite in order to represent the pages language in the url.
It is more intuitive for the users, and it will let Search engines to link directly to each language page.
See this thread for an examle to how to use the url Rewrite for this use: