Validators in multi-languages?

utilitaire

Regular
Joined
May 4, 2005
Messages
77
What is the best way to handle cross-language validation with validators?

Here's a commun validator:

Code:
<asp:RequiredFieldValidator 
	runat="server"
	ControlToValidate="toto"
	ErrorMessage="field must be filled"
>
</asp:RequiredFieldValidator>

I have to display my Error messages in multi-language, depending on cultureInfo. How would you manage that? Databinding? Code behind? I love validators since I never have to write a single line of code in the code-behind. XML is clean, and my code-behind is always very short. What would be the best way? I would like many suggestions. Theses solutions should be very elegant.

Thank you.
 
Diesel said:
Resource Files. Google Localization and/or Globalization.

Ok I've never heard of google localization. Resource files are good. I'll make more research on what you said. Thank you. :)
 
I meant search for localization/globalization in the Google search engine.

That's the definition of the phrase Google (something)

Well, if your going to be using resource files, that will solve your image dilemma. You create a resource file for each language and store the id's of the images, validator's and any other tag and it's language specific value in the resource file. Now everytime you load the page, you check the culture and loop through the resource file, assigning the values that correspond to the control/html element id's.

If it sounds complex, it's really not. The implementation is very simple. And you CAN create Multi-Lingual websites with CSS.
 
Diesel said:
I meant search for localization/globalization in the Google search engine.

That's the definition of the phrase Google (something)

Well, if your going to be using resource files, that will solve your image dilemma. You create a resource file for each language and store the id's of the images, validator's and any other tag and it's language specific value in the resource file. Now everytime you load the page, you check the culture and loop through the resource file, assigning the values that correspond to the control/html element id's.

If it sounds complex, it's really not. The implementation is very simple. And you CAN create Multi-Lingual websites with CSS.

Ok very interesting. It's a good idea to stock the UniqueID/ID as the index in the resource file. However, if I loop through all the controls:

1) I'd have to find a way to assign the text to the control in a uniform way. Since all controls dont have the same property name that describe the «text», I'd have to do a lot of «if». Example:

if(control is textbox) control .text = myString;
if(control is label) control .value = myString;

Maybe an Interface could solve this problem.

2) If I loop through all controls recursivly on the production server, I might become less performant. Actually, I dont know how much those things can slow down a server. I'm new to ASP.NET, but in classic ASP, I used to face a lot of performance issues.

3) "you CAN create Multi-Lingual websites with CSS". Can you explain a little more? I really dont understand what css has to do with it. :eek:

Thank you for you help!
 
Back
Top