Ap0st0l
Ap0st0l

Reputation: 616

How to force English language in MVC 5 ASP.NET field validation?

The title says it all... But for sure I'll give an example.

I used a DataAnnotation on my property:

[StringLength(120), MinLength(3)]
public string Title { get; set; }

And on invalid input the generated error message is in my mother language, not in English:

Pole Title musi być ciągiem lub typem tablicy o minimalnej długości 3.

How to force English language in MVC?

Upvotes: 0

Views: 1495

Answers (1)

Bas
Bas

Reputation: 2038

If you have the globalization culture and uiculture attributes in your web.config set to "auto", it'll use the browser client's language. Presumably, that's set to your mother language. If you want to force it to use English, set

<globalization culture="en-US" uiCulture="en" />

in your web.config. (It's in the system.web element.)

Upvotes: 1

Related Questions