2

I have a web project which will be used by multiple clients. I'd like to specify string in resource files so the text on the pages can be dynamic depending on which client the deployment is configured for.

For instance, I wanted to set the globalization element's uiCulture attribute in the Web.config set to "Client1" or "Client2" depending on the deployment.

Then, I would have these resource files:

  • App_GlobalResources\MySite.Client1.resx
  • App_GlobalResources\MySite.Client2.resx
  • App_LocalResources\Default.aspx.Client1.resx
  • App_LocalResources\Default.aspx.Client2.resx

Etc., etc. However, it appears that uiCulture has to be an actual/real culture. I don't want to fake it and pretend that "Client1" is "en-US" and "Client2" is "es-MX" or something like that.

How can I load resources for a specific "mode"?

Update The specific issue I'm having is that when I specify a custom UI Culture (Client1 or en-US-Client1), the resource files in my project don't seem to be compiled correctly. E.g. I end up with two classes name "MySite". Additionally, it doesn't looks like a custom culture can be provided in the Web.config (<globalization uiCulture="en-US-Client1"/>); I get the following error:

The tag contains an invalid value for the 'uiCulture' attribute.

Josh M.
  • 26,437
  • 24
  • 119
  • 200
  • I don't know if this question is a duplicate of the one I'm linking (and I think it isn't) - but this may be relevant: http://stackoverflow.com/questions/5583529/specifying-custom-resource-file-for-an-asp-net-page-usercontrol – Geeky Guy Jun 20 '13 at 15:06
  • @Renan - Thanks. I'm hoping to use the built-in auto-selecting mechanism for the culture, I just want to provide a custom culture string. – Josh M. Jun 20 '13 at 15:09
  • This post is related but there's not solid answer, just a "yes this is normal" but now how to do it: http://stackoverflow.com/questions/1059677/custom-culture-for-client-specific-verbiage – Josh M. Jun 20 '13 at 15:20
  • 1
    I have favorited this question because I'm having the same problem. So going to set a bounty as soon as I can. – Geeky Guy Jun 20 '13 at 15:24

1 Answers1

0

I had exactly the same problem. When I registered custom cultures I couldn't setup the new culture in the web.config. Also switching it in the code wasn't working - application was using default culture. This was resolved when I cleaned up the solution and manually removed bin and obj folders.

BTW. Please double check that you have the new cultures really installed i.e. in IE browser: Tools -> Internet Options -> Languages

mecool
  • 1