Programmatically change resource file language (resx) in Code Behind

前端 未结 1 1964
小鲜肉
小鲜肉 2021-02-06 04:46

I have a .Net application in C# and I have a file structure something like:

App_LocalResources
 - MyPage.aspx.resx
 - MyPage.aspx.fr.resx
MyPage.aspx
MyPage.aspx         


        
相关标签:
1条回答
  • 2021-02-06 05:17

    You must override the InitializeCulture method and put your code there. Ex:

    protected override void InitializeCulture()
    {
       base.InitializeCulture();
       System.Threading.Thread.CurrentThread.CurrentUICulture = new CultureInfo("fr-CA");
       System.Threading.Thread.CurrentThread.CurrentCulture = new CultureInfo("fr-CA");
    }
    

    Hope this helps

    0 讨论(0)
提交回复
热议问题