开发者

ASP.net default resource file handling - best practice?

开发者 https://www.devze.com 2023-03-15 15:48 出处:网络
i have a piece of code in my ASP.NET that is depend on the culture/uiCulture that the user is coming from to load few connection string values (right now, we have two, en-US and de-DE resources files)

i have a piece of code in my ASP.NET that is depend on the culture/uiCulture that the user is coming from to load few connection string values (right now, we have two, en-US and de-DE resources files).

In my 开发者_如何转开发globalization, i set the following two properties: enableClientBasedCulture="true" culture="auto:en-US" uiCulture="auto:en"

which (from what i understand), means that the application will using the client culture, and the default one (in case its not found) should be en-US, meaning, that if a user comes from france, hence, culture should be fr-FR), and i don't have a resource file that is dedicated to it, it would load the en-US.

resourceManager = new ResourceManager("MyDLL.Properties.Resources", Assembly.GetCallingAssembly());

what i get is: "Could not find any resources appropriate for the specified culture or the neutral culture".

Can anyone explain me what do i do wrong?

Thanks.


Depending on where you are calling your code, the culture might not be set yet. When you are calling the code you mentioned, what are the values of the following?

Thread.CurrentThread.CurrentCulture
Thread.CurrentThread.CurrentUICulture


found the problem, i was trying to load it from the wrong assembly.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号