how-to switch resx at runtime?

前端 未结 1 776
长发绾君心
长发绾君心 2021-01-16 10:45

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

1条回答
  •  渐次进展
    2021-01-16 11:18

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

    
    

    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 讨论(0)
提交回复
热议问题