User controls consisting of labels-idea needed

eramgarden

Contributor
Joined
Mar 8, 2004
Messages
579
This is the situation:
The asp.net 2.0/VB.net app we're developing will be localized in both English and Spanish. I will use database localization.

My thought is to create user-controls for each set of lables on a page, then populate the lables based on the language and have the user-controls cached..

I think probably, it will be hard to arrange the user controls neatly on the page. Not sure. Anyone has other ideas?

thanks
 
If you are using .Net 2.0 you might want to investigate the built in localisation features as this might be easier.

If you open a given .aspx (e.g. Default.aspx) page in the designer, go to the tools menu and select 'Generate Local Resource' - you should now find a file has been created with a .resx extension (e.g. Default.aspx.resx) in a folder named App_LocalResources. This file should contain all the localisable strings etc.

If you want to provide a Spanish version you will simply need to create a spanish version of the resx called Default.aspx.es.resx and provide a Spanish version for each entry in the original .resx that needs translating.
 
yes, i looked into that. Then emailed Scott someone at Microsoft (he has a blog) and he forwarded my email to 3 other guys. They wrote back that in the future, RESX might not be supported and the best thing to do is to use database localization...

would creating user-controls, then caching them is a bad idea for labels? Is it better to keep going to the database each time we want to get the correct translation? found a sample code for database localization but not sure if i should create user-controls for labels..
 
hmm, no , the location is not an issue . I know I want to have the translations in the database, so I'll be using database localization I'll have a custom localizetion provider:
http://www.codeproject.com/aspnet/customsqlserverprovider.asp

My issue is : going to the database each time we want to display a page , hitting the database to get the correct translation for that page....

would that be a performance issue? that's why i'm thinking maybe i should have the labels in user-comtrols and then cache the controls...instead of hitting the database for each page , each time...
 
Well that's why I suggested having them in .xml files. The textual content is static, so there's no need to hit the database server over and over again.
 
Back
Top