From a9289820552ded4eb69e710c14f03e2502538a82 Mon Sep 17 00:00:00 2001 From: Hisham Bin Ateya Date: Thu, 18 Feb 2016 02:45:26 +0300 Subject: [PATCH] Localization Sample Fix --- samples/LocalizationSample/Startup.cs | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/samples/LocalizationSample/Startup.cs b/samples/LocalizationSample/Startup.cs index 471a678920..218fceff51 100644 --- a/samples/LocalizationSample/Startup.cs +++ b/samples/LocalizationSample/Startup.cs @@ -36,21 +36,19 @@ namespace LocalizationSample #if !DNXCORE50 supportedCultures.Add(new CultureInfo("zh-CHT")); #endif - app.UseRequestLocalization(new RequestLocalizationOptions - { + var options = new RequestLocalizationOptions { DefaultRequestCulture = new RequestCulture("en-US"), - - // Set options here to change middleware behavior SupportedCultures = supportedCultures, SupportedUICultures = supportedCultures + }; + // Optionally create an app-specific provider with just a delegate, e.g. look up user preference from DB. + // Inserting it as position 0 ensures it has priority over any of the default providers. + //options.RequestCultureProviders.Insert(0, new CustomRequestCultureProvider(async context => + //{ - // Optionally create an app-specific provider with just a delegate, e.g. look up user preference from DB. - // Inserting it as position 0 ensures it has priority over any of the default providers. - //RequestCultureProviders.Insert(0, new CustomRequestCultureProvider(async context => - //{ + //})); - //})) - }); + app.UseRequestLocalization(options); app.Use(async (context, next) => { @@ -165,4 +163,4 @@ $@" host.Run(); } } -} +} \ No newline at end of file