From 77f00014c69e40137fa5d81deb3459abfa380df5 Mon Sep 17 00:00:00 2001 From: "DarkLiKally (Stefan Sch)" Date: Wed, 26 Sep 2018 19:24:53 +0200 Subject: [PATCH] Pushed version number and little cleanup --- examples/Example.WebApp/Startup.cs | 59 ++++++++----------- .../I18Next.Net.Abstractions.csproj | 2 +- .../I18Next.Net.AspNetCore.csproj | 2 +- .../I18Next.Net.Extensions.csproj | 2 +- src/I18Next.Net.ICU/I18Next.Net.ICU.csproj | 2 +- .../I18Next.Net.PolyglotJs.csproj | 2 +- src/I18Next.Net/I18Next.Net.csproj | 2 +- src/I18Next.Net/I18NextNet.cs | 2 - 8 files changed, 30 insertions(+), 43 deletions(-) diff --git a/examples/Example.WebApp/Startup.cs b/examples/Example.WebApp/Startup.cs index 16ff009..5993589 100644 --- a/examples/Example.WebApp/Startup.cs +++ b/examples/Example.WebApp/Startup.cs @@ -1,14 +1,8 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using I18Next.Net.AspNetCore; +using I18Next.Net.AspNetCore; +using I18Next.Net.Backends; using I18Next.Net.Extensions; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; -using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.HttpsPolicy; -using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; @@ -23,48 +17,43 @@ public Startup(IConfiguration configuration) public IConfiguration Configuration { get; } - // This method gets called by the runtime. Use this method to add services to the container. - public void ConfigureServices(IServiceCollection services) - { - services.Configure(options => - { - // This lambda determines whether user consent for non-essential cookies is needed for a given request. - options.CheckConsentNeeded = context => true; - options.MinimumSameSitePolicy = SameSiteMode.None; - }); - - services.AddI18NextLocalization(i18n => i18n.IntegrateToAspNetCore()); - - services.AddMvc() - .SetCompatibilityVersion(CompatibilityVersion.Version_2_1) - .AddI18NextViewLocalization(); - } - // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env) { if (env.IsDevelopment()) - { app.UseDeveloperExceptionPage(); - } else - { app.UseExceptionHandler("/Home/Error"); - app.UseHsts(); - } + // Enable request localization in order to determine the users desired language based on the Accept-Language header. app.UseRequestLocalization(options => options.AddSupportedCultures("de", "en")); - - app.UseHttpsRedirection(); + app.UseStaticFiles(); - app.UseCookiePolicy(); app.UseMvc(routes => { routes.MapRoute( - name: "default", - template: "{controller=Home}/{action=Index}/{id?}"); + "default", + "{controller=Home}/{action=Index}/{id?}"); }); } + + // This method gets called by the runtime. Use this method to add services to the container. + public void ConfigureServices(IServiceCollection services) + { + // Option 1: Simple setup for AspNetCore using the default configuration + services.AddI18NextLocalization(i18n => i18n.IntegrateToAspNetCore()); + + // Option 2: Customize the locales location in order to use the same json files on the client side. + // services.AddI18NextLocalization(i18n => + // { + // i18n.IntegrateToAspNetCore() + // .AddBackend(new JsonFileBackend("wwwroot/locales")); + // }); + + services.AddMvc() + // Enable view localization and register required I18Next services + .AddI18NextViewLocalization(); + } } } diff --git a/src/I18Next.Net.Abstractions/I18Next.Net.Abstractions.csproj b/src/I18Next.Net.Abstractions/I18Next.Net.Abstractions.csproj index 79f246d..3d09076 100644 --- a/src/I18Next.Net.Abstractions/I18Next.Net.Abstractions.csproj +++ b/src/I18Next.Net.Abstractions/I18Next.Net.Abstractions.csproj @@ -5,7 +5,7 @@ I18Next.Net DarkLiKally DarkLiKally - 0.5.1 + 0.6.0 https://github.com/DarkLiKally/I18Next.Net https://github.com/DarkLiKally/I18Next.Net git diff --git a/src/I18Next.Net.AspNetCore/I18Next.Net.AspNetCore.csproj b/src/I18Next.Net.AspNetCore/I18Next.Net.AspNetCore.csproj index 5290fa6..6c55a21 100644 --- a/src/I18Next.Net.AspNetCore/I18Next.Net.AspNetCore.csproj +++ b/src/I18Next.Net.AspNetCore/I18Next.Net.AspNetCore.csproj @@ -6,7 +6,7 @@ false https://github.com/DarkLiKally/I18Next.Net https://github.com/DarkLiKally/I18Next.Net - 0.5.1 + 0.6.0 DarkLiKally git diff --git a/src/I18Next.Net.Extensions/I18Next.Net.Extensions.csproj b/src/I18Next.Net.Extensions/I18Next.Net.Extensions.csproj index 9c8cf12..aa61f65 100644 --- a/src/I18Next.Net.Extensions/I18Next.Net.Extensions.csproj +++ b/src/I18Next.Net.Extensions/I18Next.Net.Extensions.csproj @@ -4,7 +4,7 @@ I18Next.Net DarkLiKally DarkLiKally - 0.5.1 + 0.6.0 https://github.com/DarkLiKally/I18Next.Net https://github.com/DarkLiKally/I18Next.Net git diff --git a/src/I18Next.Net.ICU/I18Next.Net.ICU.csproj b/src/I18Next.Net.ICU/I18Next.Net.ICU.csproj index 9a2de5b..c06b149 100644 --- a/src/I18Next.Net.ICU/I18Next.Net.ICU.csproj +++ b/src/I18Next.Net.ICU/I18Next.Net.ICU.csproj @@ -8,7 +8,7 @@ https://github.com/DarkLiKally/I18Next.Net git I18Next.Net - 0.5.1 + 0.6.0 diff --git a/src/I18Next.Net.PolyglotJs/I18Next.Net.PolyglotJs.csproj b/src/I18Next.Net.PolyglotJs/I18Next.Net.PolyglotJs.csproj index beb5032..2bf9570 100644 --- a/src/I18Next.Net.PolyglotJs/I18Next.Net.PolyglotJs.csproj +++ b/src/I18Next.Net.PolyglotJs/I18Next.Net.PolyglotJs.csproj @@ -8,7 +8,7 @@ https://github.com/DarkLiKally/I18Next.Net https://github.com/DarkLiKally/I18Next.Net git - 0.5.1 + 0.6.0 diff --git a/src/I18Next.Net/I18Next.Net.csproj b/src/I18Next.Net/I18Next.Net.csproj index c179d0d..976006f 100644 --- a/src/I18Next.Net/I18Next.Net.csproj +++ b/src/I18Next.Net/I18Next.Net.csproj @@ -5,7 +5,7 @@ false https://github.com/DarkLiKally/I18Next.Net https://github.com/DarkLiKally/I18Next.Net - 0.5.1 + 0.6.0 DarkLiKally git diff --git a/src/I18Next.Net/I18NextNet.cs b/src/I18Next.Net/I18NextNet.cs index 8ae2a24..ae78250 100644 --- a/src/I18Next.Net/I18NextNet.cs +++ b/src/I18Next.Net/I18NextNet.cs @@ -31,8 +31,6 @@ public I18NextNet(ITranslationBackend backend, ITranslator translator, ILanguage public ILogger Logger { get; set; } - public List PostProcessors => Translator.PostProcessors; - public ITranslator Translator { get; } public ITranslationBackend Backend { get; }