Ejemplo n.º 1
0
 // This method gets called by the runtime. Use this method to add services to the container.
 public void ConfigureServices(IServiceCollection services)
 {
     ConfigureRepositories.AddServices(services, Configuration);
     ConfigureServiceDepenedencies.AddServices(services);
     services.AddAutoMapper(typeof(Startup));
     services.AddControllers();
     services.AddSwaggerGen(c =>
     {
         c.SwaggerDoc("v1", new OpenApiInfo {
             Title = "WebApi", Version = "v1"
         });
     });
 }
Ejemplo n.º 2
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddLocalization(options => options.ResourcesPath = "Resources");

            services.AddMvc()
            .AddViewLocalization(LanguageViewLocationExpanderFormat.Suffix)
            .AddDataAnnotationsLocalization()
            .AddMvcLocalization();

            services.Configure <RequestLocalizationOptions>(opts =>
            {
                var supportedCultures = new List <CultureInfo>
                {
                    new CultureInfo("en"),
                    new CultureInfo("fr"),
                    new CultureInfo("hi-IN"),
                    new CultureInfo("ba-RU"),
                    new CultureInfo("ar-SA"),
                    new CultureInfo("gu-IN")
                };
                opts.DefaultRequestCulture = new RequestCulture("en");
                opts.SupportedCultures     = supportedCultures;
                opts.SupportedUICultures   = supportedCultures;
            });

            //var cultureInfo = new CultureInfo("ar-SA"); //arabic
            //var cultureInfo = new CultureInfo("hi-IN"); //Hindi
            // var cultureInfo = new CultureInfo("gu-IN"); // Gujarati
            //var cultureInfo = new CultureInfo("ba-RU"); //Russian
            //var cultureInfo = new CultureInfo("fr"); //French
            //CultureInfo.DefaultThreadCurrentCulture = cultureInfo;
            //CultureInfo.DefaultThreadCurrentUICulture = cultureInfo;


            //services.AddControllersWithViews().
            //    AddMvcLocalization()
            //    .AddViewLocalization()
            //    .AddDataAnnotationsLocalization();

            ConfigureRepositories.AddServices(services, Configuration);
            ConfigureServiceDepenedencies.AddServices(services);
            services.AddAutoMapper(typeof(Startup));
        }