# .Net Core切換語系 1.調整 Startup的 ConfigureServices,並且指定路徑為 "Resources" ``` services.AddLocalization(options => options.ResourcesPath = "Resources"); services.AddMvc() //.AddViewLocalization() .AddViewLocalization(LanguageViewLocationExpanderFormat.Suffix);//要使用View多國語系的話就加這行程式碼 ``` 2.在Configure中設定支援的語系列表 預設的文化及UI文化(一個是顯示的語言,一個是資料顯示的格式) ``` var supportedCultures = new List<CultureInfo>() { new CultureInfo("zh-TW"), new CultureInfo("en-US"), }; app.UseRequestLocalization(new RequestLocalizationOptions() { DefaultRequestCulture = new RequestCulture("zh-TW"), SupportedCultures = supportedCultures, SupportedUICultures = supportedCultures, }); ``` 3.在Resourcees資料夾建立資源檔(.resx),並位置相對應View  4.建立資料  5.在View上面新增以下程式碼 ``` @using Microsoft.AspNetCore.Mvc.Localization @inject IViewLocalizer MyViewLocalizer ``` 6.將原本文字改成在資源檔所建立的名稱 
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up