问题
I am new to Griffin localization, it seems very cool. However, examples are only showing me how to translate MVC validation attributes.
I am using minimum if not none of the mvc validation attributes. My idea is (try) not to validate and report messages twice at data layer and UI layer. I create validators at data layer with with Fluent Validation.
Could you please give me a quick pointer (if it exists) how we can integrate Griffin Localization with Fluent Validation at data layer?
回答1:
Griffin.MvcContrib do not have any support for Fluent Validation.
Just took a quick look at fluent validation and it seems like it pulls its string from IStringSource. So you could basically create an adapter for it which reads the strings from the Griffin.MvcContrib resources.
Something like:
public class FluentValidationTranslator : IStringSource
{
public FluentValidationTranslator(ILocalizedStringProvider griffinProvider)
{
}
// implement the translation here
}
来源:https://stackoverflow.com/questions/11474293/griffin-localization-and-fluent-validation