views:

51

answers:

1

Hello, I'm developing a website using ASP.NET MVC. The website should handle multiple languages. I would like to ask what are the best practices of handling multiple languagues - both for "static" texts and taken from DB. I read some threads about this on stackoverflow but i'm not sure how can I implement in when data from DB are received. I also read this article

+1  A: 

Well, if you need to localize your web application then you can't really use any "static" text. The article link you included talks about using resource files. While this does work in ASP.Net MVC it means that everything in your view pages will have to be an ASP.Net Literal control and you have to push ALL of your textual content into the .RES file and not put any of it in your view pages.

If you have a lot of users from different cultures then using the .RES files will be the way to go. If you have the majority of your users all in one language and just a small percentage in a different language then you may be able to take advantage of Microsoft’s translation engine. You just embed some JavaScript in your page and Microsoft will translate the page’s text for you.

Mark Ewer
writing "static" text I meant the text NOT from DB. I have already had the resource file. The question still to go is how can i handle texts from DB
niao
For DB data you have two choices. You can have your users type the data in multiple times (once in each supported language) or you can use a translation engine. If you have a set of commonly reused labels or terms then you can store in the database just the name of the resource item.
Mark Ewer