using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Localization;
using System.Collections.Generic;
using System.Globalization;

namespace IRaCIS.Core.API
{
    public static class LocalizationConfig
    {

        public static void UseLocalization(this IApplicationBuilder app)
        {
            var supportedCultures = new List<CultureInfo>
            {
                new CultureInfo("en-US"),
                new CultureInfo("zh-CN")
            };

            var options = new RequestLocalizationOptions
            {
                //DefaultRequestCulture = new RequestCulture("en-US"),
                SupportedCultures = supportedCultures,
                SupportedUICultures = supportedCultures,

                ApplyCurrentCultureToResponseHeaders = true
            };

            //options.RequestCultureProviders.RemoveAt(0);
            //options.RequestCultureProviders.RemoveAt(1);

            app.UseRequestLocalization(options);
        }
    }
}
