From bc4426cf4453b718846470f369c36ee4283c2a55 Mon Sep 17 00:00:00 2001 From: Pavel Krymets Date: Tue, 2 Feb 2016 12:52:59 -0800 Subject: [PATCH] Fix sample on CoreClr --- samples/LocalizationSample/Startup.cs | 40 +++++++++++---------------- 1 file changed, 16 insertions(+), 24 deletions(-) diff --git a/samples/LocalizationSample/Startup.cs b/samples/LocalizationSample/Startup.cs index f9baa83810..ca3b393227 100644 --- a/samples/LocalizationSample/Startup.cs +++ b/samples/LocalizationSample/Startup.cs @@ -22,35 +22,27 @@ namespace LocalizationSample public void Configure(IApplicationBuilder app, IStringLocalizer SR) { + var supportedCultures = new List + { + new CultureInfo("en-US"), + new CultureInfo("en-AU"), + new CultureInfo("en-GB"), + new CultureInfo("es-ES"), + new CultureInfo("ja-JP"), + new CultureInfo("fr-FR"), + new CultureInfo("zh"), + new CultureInfo("zh-CN") + }; +#if !DNXCORE50 + supportedCultures.Add(new CultureInfo("zh-CHT")); +#endif app.UseRequestLocalization(new RequestLocalizationOptions { DefaultRequestCulture = new RequestCulture("en-US"), // Set options here to change middleware behavior - SupportedCultures = new List - { - new CultureInfo("en-US"), - new CultureInfo("en-AU"), - new CultureInfo("en-GB"), - new CultureInfo("es-ES"), - new CultureInfo("ja-JP"), - new CultureInfo("fr-FR"), - new CultureInfo("zh"), - new CultureInfo("zh-CN"), - new CultureInfo("zh-CHT") - }, - SupportedUICultures = new List - { - new CultureInfo("en-US"), - new CultureInfo("en-AU"), - new CultureInfo("en-GB"), - new CultureInfo("es-ES"), - new CultureInfo("ja-JP"), - new CultureInfo("fr-FR"), - new CultureInfo("zh"), - new CultureInfo("zh-CN"), - new CultureInfo("zh-CHT") - } + 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.