detect os language from c#

后端 未结 7 1300
北荒
北荒 2020-12-06 01:32

Is there a way to detect the Language of the OS from within a c# class?

7条回答
  •  Happy的楠姐
    2020-12-06 01:46

    Means that if the system locale on Region and Language, you can use Win32 API function GetSystemDefaultLCID. The signiture is as follow:

    [DllImport("kernel32.dll")]
    static extern uint GetSystemDefaultLCID();
    

    GetSystemDefaultLCID function returns the LCID. It can map language string from the folowing table. Locale IDs Assigned by Microsoft

提交回复
热议问题