2017-08-24 5 views
-2

私はMVC5のアプリケーションを持っており、いつも完璧に動作しました!今私は新しいaspnetcore mvc 6を使用して新しいアプリを開始し、私は仕事にアクセントを置くことができませんでした。Accentuationが機能していませんAspnet Core

私はここに同じ問題を抱えた投稿を見つけましたが、私は答えとして正確に行いましたが、うまくいきませんでした。

EDIT:<system.web> globalization in .net core

EDIT:ここに私のページアクセントエラーと。 enter image description here

マイコード:私のレイアウトページで

public void ConfigureServices(IServiceCollection services) 
     { 
      //Setting Culture 

      services.AddLocalization(options => options.ResourcesPath = "Resources"); 

      services.AddMvc().AddViewLocalization().AddDataAnnotationsLocalization(); 

      //services.AddScoped<LanguageActionFilter>(); 

      services.Configure<RequestLocalizationOptions>(
       options => 
       { 
        var supportedCultures = new List<CultureInfo> 
         { 
          new CultureInfo("pt-BR") 

         }; 

        options.DefaultRequestCulture = new RequestCulture(culture: "pt-BR", uiCulture: "pt-BR"); 
        options.SupportedCultures = supportedCultures; 
        options.SupportedUICultures = supportedCultures; 
       }); 

はそのようなものです:

<!DOCTYPE html> 
<html lang="pt-br"> 
<head> 
    <meta charset="utf-8" /> 
    <meta name="viewport" content="width=device-width, initial-scale=1.0" /> 
    <title>CRM Online</title> 
    <meta http-equiv="X-UA-Compatible" content="IE=edge"> 

任意の手掛かり?

答えて

0

statup.csで自分のカルチャーを設定する方法が見つかりました。その前に、アクセントの問題を回避方法で解決し、Add> New Item> Web> Viewを使用して新しいビューを作成しました。このようにしてacentuationが機能します。

しかし、私がを追加して新しいビューを作成した場合、>表示と表示されません。誰か説明できますか?プロジェクトがUFT-8をどう解釈するかについて私は何かを見ました。 statup.csに文化を設定する

public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, CRMContext context) 
     { 
      loggerFactory.AddConsole(Configuration.GetSection("Logging")); 
      loggerFactory.AddDebug(); 

      if (env.IsDevelopment()) 
      { 
       app.UseDeveloperExceptionPage(); 
       app.UseDatabaseErrorPage(); 
       app.UseBrowserLink(); 
      } 
      else 
      { 
       app.UseExceptionHandler("/Home/Error"); 
      } 

      //Fixar Cultura para pt-BR 
      RequestLocalizationOptions localizationOptions = new RequestLocalizationOptions 
      { 
       SupportedCultures = new List<CultureInfo> { new CultureInfo("pt-BR") }, 
       SupportedUICultures = new List<CultureInfo> { new CultureInfo("pt-BR") }, 
       DefaultRequestCulture = new RequestCulture("pt-BR") 
      }; 

      app.UseRequestLocalization(localizationOptions);  
      app.UseStaticFiles(); 
      app.UseIdentity(); 

      // Add external authentication middleware below. To configure them please see https://go.microsoft.com/fwlink/?LinkID=532715 

      app.UseMvc(routes => 
      { 
       routes.MapRoute(
        name: "default", 
        template: "{controller=Home}/{action=Index}/{id?}"); 
      }); 

      context.Database.EnsureCreated(); 
     } 

これがどのように動作するかです: enter image description here

これはここいけない仕事 enter image description here

が私の見解を強調して作業する方法です。 enter image description here

関連する問題