Reputation: 33867
I have an ASP.net MVC site, which I want to use a couple of resource files to set some strings.
I have a class library containing my viewmodels, and I have added a resource file (ValidationMessages) there, with a single string (called Test), and then have a property like so in my view model:
public string TestResource
{
get
{
return ValidationMessages.Test;
}
}
And that works fine, when output on my view like so:
<div>@Model.TestResource</div>
If I add a ValidationMessages.en-au.resx (my default would be en-gb) file to my class library and create a different version of the test string, and then have the following in my global.asax:
protected void Application_AcquireRequestState(object sender, EventArgs e)
{
Thread.CurrentThread.CurrentCulture = CultureInfo.GetCultureInfo("en-au");
Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfo("en-au");
}
And this also works fine.
What I want to do is add a custom culture 'en-gb-ly' - I have registered this culture on my machine ok (using code from here). When I set the current culture to "en-gb-ly" in my global.asax and include a ValidationMessages.en-gb-ly.resx in my class library, the output has reverted back to the 'base' version of the Test string, not the one in my en-gb-ly resource.
Anybody any idea why this might be happening?
Upvotes: 1
Views: 938
Reputation: 15410
A first thing to check is that the en-ly satellite assembly gets deployed as expected. Unfortunately if your custom culture is not installed on your build machine, then it won't even get built!
Upvotes: 2