MvcExtensions / Core

MvcExtensions - Extend everything
Microsoft Public License
52 stars 17 forks source link

AsEmail() is not localized #3

Closed ShurikEv closed 12 years ago

ShurikEv commented 12 years ago

How can i localize error message for the "email invalid format" message?

hazzik commented 12 years ago

You could set it via

StringMetadataItemBuilder.EmailErrorMessage property or StringMetadataItemBuilder.EmailErrorMessageResourceType and StringMetadataItemBuilder.EmailErrorMessageResourceName in your Global.asax.cs (or where your startup code lives)

StringMetadataItemBuilder.EmailErrorMessage = "Неверный формат адреса электронной почты";

OR

StringMetadataItemBuilder.EmailErrorMessageResourceType = typeof(YourResources);
StringMetadataItemBuilder.EmailErrorMessageResourceName = "InvalidEmail";

In second case you have to have YourResources resource with InvalidEmail property.

ShurikEv commented 12 years ago

Thanks