C#判斷系統語系的方法

C#判斷系統語系的方法

C#判斷系統語系的方法

 


資料來源:http://stackoverflow.com/questions/5710127/get-operating-system-language-in-c-sharp

http://blog.xuite.net/grimmslaw/78/42296179-c%23+%E5%A4%9A%E5%9C%8B%E8%AA%9E%E8%A8%80%E5%AF%A6%E4%BD%9C

http://jjnnykimo.pixnet.net/blog/post/45296600


Code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Globalization;
using System.Threading;

namespace CS_Console_Check_Language
{
    class Program
    {
        static void Pause()
        {
            Console.Write("Press any key to continue . . . ");
            Console.ReadKey(true);
        }
        static void Main(string[] args)
        {
            CultureInfo ci = CultureInfo.InstalledUICulture;

            Console.WriteLine("Default Language Info:");
            
            Console.WriteLine("* Name: {0}", ci.Name);
            Console.WriteLine("* Display Name: {0}", ci.DisplayName);
            Console.WriteLine("* English Name: {0}", ci.EnglishName);
            Console.WriteLine("* 2-letter ISO Name: {0}", ci.TwoLetterISOLanguageName);
            Console.WriteLine("* 3-letter ISO Name: {0}", ci.ThreeLetterISOLanguageName);
            Console.WriteLine("* 3-letter Win32 API Name: {0}", ci.ThreeLetterWindowsLanguageName);
            Console.WriteLine("* Calendar: {0}", ci.Calendar);
            Console.WriteLine("* CompareInfo: {0}", ci.CompareInfo);
            Console.WriteLine("* CultureTypes: {0}", ci.CultureTypes);
            Console.WriteLine("* IetfLanguageTag: {0}", ci.IetfLanguageTag);
            Console.WriteLine("* KeyboardLayoutId: {0}", ci.KeyboardLayoutId);
            Console.WriteLine("* LCID: {0}", ci.LCID);
            Console.WriteLine("* NativeName: {0}", ci.NativeName);
            Console.WriteLine("* Parent: {0}", ci.Parent);
            Console.WriteLine("* TextInfo: {0}", ci.TextInfo);
            Console.WriteLine("* UseUserOverride: {0}", ci.UseUserOverride);
            Console.WriteLine("* CurrentUICulture.Name: {0}\t(地區&語言->顯示語言)", Thread.CurrentThread.CurrentUICulture.Name);//地區&語言->顯示語言
            Console.WriteLine("* CultureInfo.CurrentCulture.Name: {0}\t(地區&語言->格式)", System.Globalization.CultureInfo.CurrentCulture.Name);//地區&語言->格式
            Pause();
        }
    }
}


 

 

 

發表迴響

你的電子郵件位址並不會被公開。 必要欄位標記為 *