开发者

how-to switch resx at runtime?

开发者 https://www.devze.com 2023-01-12 00:38 出处:网络
I have a second resx file Strings.ps-ps开发者_如何学运维.resx that I want to point my code to at runtime. Each resx has Designer.cs with a unique class name.Do I have to switch/wrap these things mysel

I have a second resx file Strings.ps-ps开发者_如何学运维.resx that I want to point my code to at runtime. Each resx has Designer.cs with a unique class name. Do I have to switch/wrap these things myself? ...or is there some built in approach?


You need to change your UI Culture to use a different resx file. This can be done in config

<globalization uiCulture="es" culture="es-MX" />

or in code

Thread.CurrentThread.CurrentUICulture = new CultureInfo("fr-FR");;

If you want to automatically adapt to the user, you can query the HttpContext.Current.Request.UserLanguages for the users browser settings

0

精彩评论

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