开发者

How do I change the current Resource Manager at runtime to switch languages?

I have a C# application and I'm trying to make it support multiple languages by referencing different resx files using the resource manager.

I have this code in my Desig开发者_如何学Pythonner.cs:

        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
    public static global::System.Resources.ResourceManager ResourceManager {
        get {
            if (object.ReferenceEquals(resourceMan, null)) {
                global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("project.resources.en-US", typeof(resources.en-US).Assembly);
                resourceMan = temp;
            }
            return resourceMan;
        }
    }

How can I switch System.Resources.ResourceManager("project.resources.en-US", typeof(resources.en-US).Assembly) to System.Resources.ResourceManager("project.resources.it-IT", typeof(resources.it-IT).Assembly) at runtime without modifying my Designer.cs code? Is it possible?

This question is related

Edit: To clarify, I realize I'm not supposed to change my designer code, but I'm trying to make it so that I access a different resx file. I apologize if my question was ill-worded, but I guess I don't completely understand what I'm talking about. I'm currently looking into satellite assemblies.


just change current culture info and the job should be done. System.Threading.Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US");

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜