1- using System . Collections . Generic ;
2- using System . Globalization ;
3- using System . IO ;
1+ using System . IO ;
42using System . Linq ;
53using Microsoft . AspNetCore . Builder ;
64using Microsoft . AspNetCore . Hosting ;
7- using Microsoft . AspNetCore . Localization ;
85using Microsoft . Extensions . Configuration ;
96using Microsoft . Extensions . DependencyInjection ;
10- using Microsoft . Extensions . Options ;
117using MyCompanyName . MyProjectName . EntityFrameworkCore ;
128using Swashbuckle . AspNetCore . Swagger ;
139using Volo . Abp ;
2218using Volo . Abp . Identity ;
2319using Volo . Abp . Identity . EntityFrameworkCore ;
2420using Volo . Abp . Identity . Web ;
21+ using Volo . Abp . Localization ;
2522using Volo . Abp . Modularity ;
2623using Volo . Abp . PermissionManagement . EntityFrameworkCore ;
2724using Volo . Abp . SettingManagement . EntityFrameworkCore ;
@@ -81,17 +78,10 @@ public override void ConfigureServices(ServiceConfigurationContext context)
8178 options . DocInclusionPredicate ( ( docName , description ) => true ) ;
8279 } ) ;
8380
84- var cultures = new List < CultureInfo >
81+ context . Services . Configure < AbpLocalizationOptions > ( options = >
8582 {
86- new CultureInfo ( "en" )
87- //Add other languages...
88- } ;
89-
90- context . Services . Configure < RequestLocalizationOptions > ( options =>
91- {
92- options . DefaultRequestCulture = new RequestCulture ( "en" ) ;
93- options . SupportedCultures = cultures ;
94- options . SupportedUICultures = cultures ;
83+ options . Languages . Add ( new LanguageInfo ( "en" , "en" , "English" ) ) ;
84+ //...add other languages
9585 } ) ;
9686
9787 context . Services . AddAssemblyOf < DemoAppModule > ( ) ;
@@ -110,7 +100,6 @@ public override void OnApplicationInitialization(ApplicationInitializationContex
110100 app . UseErrorPage ( ) ;
111101 }
112102
113- app . UseStaticFiles ( ) ;
114103 app . UseVirtualFiles ( ) ;
115104
116105 app . UseSwagger ( ) ;
@@ -120,9 +109,7 @@ public override void OnApplicationInitialization(ApplicationInitializationContex
120109 } ) ;
121110
122111 app . UseAuthentication ( ) ;
123-
124- app . UseRequestLocalization ( app . ApplicationServices . GetRequiredService < IOptions < RequestLocalizationOptions > > ( ) . Value ) ;
125-
112+ app . UseAbpRequestLocalization ( ) ;
126113 app . UseAuditing ( ) ;
127114
128115 app . UseMvc ( routes =>
0 commit comments