File tree Expand file tree Collapse file tree 2 files changed +19
-15
lines changed
BootstrapBlazor.Server/Extensions
BootstrapBlazor.Shared/Extensions Expand file tree Collapse file tree 2 files changed +19
-15
lines changed Original file line number Diff line number Diff line change 55
66using BootstrapBlazor . Service . Services ;
77using Microsoft . AspNetCore . SignalR ;
8+ using Microsoft . Extensions . Options ;
89using System . Text . Encodings . Web ;
910using System . Text . Unicode ;
1011
@@ -17,9 +18,27 @@ public static IServiceCollection AddBootstrapBlazorServerService(this IServiceCo
1718 // 增加中文编码支持网页源码显示汉字
1819 services . AddSingleton ( HtmlEncoder . Create ( UnicodeRanges . All ) ) ;
1920
21+ // 增加错误日志
2022 services . AddLogging ( logBuilder => logBuilder . AddFileLogger ( ) ) ;
23+
24+ // 增加跨域服务
2125 services . AddCors ( ) ;
2226
27+ // 增加多语言支持配置信息
28+ services . AddRequestLocalization < IOptionsMonitor < BootstrapBlazorOptions > > ( ( localizerOption , blazorOption ) =>
29+ {
30+ blazorOption . OnChange ( Invoke ) ;
31+ Invoke ( blazorOption . CurrentValue ) ;
32+ return ;
33+
34+ void Invoke ( BootstrapBlazorOptions option )
35+ {
36+ var supportedCultures = option . GetSupportedCultures ( ) ;
37+ localizerOption . SupportedCultures = supportedCultures ;
38+ localizerOption . SupportedUICultures = supportedCultures ;
39+ }
40+ } ) ;
41+
2342#if DEBUG
2443#else
2544 services . AddResponseCompression ( options =>
Original file line number Diff line number Diff line change @@ -35,21 +35,6 @@ public static IServiceCollection AddBootstrapBlazorServices(this IServiceCollect
3535 // 增加 Baidu ORC 服务
3636 services . AddBootstrapBlazorBaiduOcr ( ) ;
3737
38- // 增加多语言支持配置信息
39- services . AddRequestLocalization < IOptionsMonitor < BootstrapBlazorOptions > > ( ( localizerOption , blazorOption ) =>
40- {
41- blazorOption . OnChange ( Invoke ) ;
42- Invoke ( blazorOption . CurrentValue ) ;
43- return ;
44-
45- void Invoke ( BootstrapBlazorOptions option )
46- {
47- var supportedCultures = option . GetSupportedCultures ( ) ;
48- localizerOption . SupportedCultures = supportedCultures ;
49- localizerOption . SupportedUICultures = supportedCultures ;
50- }
51- } ) ;
52-
5338 // 增加 AzureOpenAI 服务
5439 services . AddBootstrapBlazorAzureOpenAIService ( ) ;
5540
You can’t perform that action at this time.
0 commit comments