views:

42

answers:

3

Is there a simple way of making the static content of an .aspx page multi-lingual? Resource files are nice for controls but it's quite hard and annoying to write big chunks of html in them. Any easier ways?

+2  A: 

Make properties in resources files and use them, .NET automatically finds the correct resource file, also just make sure so that the property name is same in all the resource files, so it will replace the property value in .aspx page with the value in the resource file.

Don't code html markup in resource file, have the html markup in the .aspx page itself, just get the essential values from resource files.

Mahesh Velaga
So when I have content with some <strong> tags, I have to split the resource into 4-5 different strings?
ciscoheat
Yes, as it gives you more flexibility, if you want to change the html markup later, instead of changing the markup in all the resource files you can just change it in the .aspx page :)
Mahesh Velaga
It makes sense, and it could be interesting to go completely purist on this for once. I see there is a Localize web control, so I better get started. Thanks!
ciscoheat
A: 

Just to reiterate what Mahesh said: do NOT put markup in the resource files, just put the static content into them.

If you need to serve different views based on culture, consider doing something else. For example, if you're using MVC you could write a view engine that return the correct markup for each culture.

Esteban Araya
That would be quite nice, but now I'm kind of stuck with the classic ASP.NET model and would like to know if you can do anything to simplify the work. :)
ciscoheat
A: 

@ciscoheat what you say is correct, LOCALIZE control is the right thing to use for big chunk of data.

isthatacode