Skip to content

Commit 60af62d

Browse files
committed
doc: 增加资源文件
1 parent d74f79d commit 60af62d

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

src/BootstrapBlazor/Components/NetworkMonitor/NetworkMonitorIndicator.razor.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
// See the LICENSE file in the project root for more information.
44
// Maintainer: Argo Zhang([email protected]) Website: https://www.blazor.zone
55

6+
using Microsoft.Extensions.Localization;
7+
68
namespace BootstrapBlazor.Components;
79

810
/// <summary>
@@ -32,8 +34,11 @@ public partial class NetworkMonitorIndicator
3234
[NotNull]
3335
public string? Trigger { get; set; }
3436

37+
[Inject, NotNull]
38+
private IStringLocalizer<NetworkMonitorIndicator>? Localizer { get; set; }
39+
3540
private NetworkMonitorState _state = new();
36-
private List<string> _indicators = [];
41+
private readonly List<string> _indicators = [];
3742

3843
private string? ClassString => CssBuilder.Default("bb-nt-indicator")
3944
.AddClass("bb-nt-indicator-4g", _state.NetworkType == "4g")
@@ -60,7 +65,7 @@ protected override void OnParametersSet()
6065
base.OnParametersSet();
6166

6267
Trigger ??= "hover focus";
63-
Title ??= "网络状态";
68+
Title ??= Localizer["NetworkMonitorIndicatorTitle"];
6469
}
6570

6671
private Task OnNetworkStateChanged(NetworkMonitorState state)

src/BootstrapBlazor/Locales/en.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,5 +389,8 @@
389389
},
390390
"BootstrapBlazor.Components.ValidateBase": {
391391
"DefaultRequiredErrorMessage": "{0} is required."
392+
},
393+
"BootstrapBlazor.Components.NetworkMonitorIndicator": {
394+
"NetworkMonitorIndicatorTitle": "Network"
392395
}
393396
}

src/BootstrapBlazor/Locales/zh.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,5 +389,8 @@
389389
},
390390
"BootstrapBlazor.Components.ValidateBase": {
391391
"DefaultRequiredErrorMessage": "{0}是必填项"
392+
},
393+
"BootstrapBlazor.Components.NetworkMonitorIndicator": {
394+
"NetworkMonitorIndicatorTitle": "网络状态"
392395
}
393396
}

0 commit comments

Comments
 (0)