Force exceptions language in English

前端 未结 7 1829
孤城傲影
孤城傲影 2020-12-08 00:35

My Visual Studio 2005 is a French one, installed on a French OS. All the exceptions I receive during debug or runtime I obtain also in French.

Can I howev

相关标签:
7条回答
  • 2020-12-08 01:15

    Finally a "sharp" solution could be the following:

    [STAThread]
    static void Main()
    {
        Application.EnableVisualStyles();
        Application.SetCompatibleTextRenderingDefault(false);
    
    #if DEBUG
        // Add this; Change the Locales(En-US): Done.
        Thread.CurrentThread.CurrentUICulture = Thread.CurrentThread.CurrentCulture;
    #endif
    
        Application.Run(new Form1());
    }
    

    However I'd like a solution without modifications in the project code.

    From MSDN:

    The CurrentUICulture property will be set implicitly if an application does specify a CurrentUICulture. If CurrentUICulture is not set explicitly in an application's code, it is set by the GetUserDefaultUILanguage function on Windows 2000 and Windows XP Multilingual User Interface (MUI) products where the end user can set the default language. If the user's UI language is not set, it will be set by the system-installed language, which is the language of the operating system's resources.

    If an application is Web-based, the CurrentUICulture can be set explicitly in application code to the user's browser accept language.

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