Skip to content

Commit 77b50a7

Browse files
committed
doc: 增加本地化
1 parent 63f9624 commit 77b50a7

File tree

4 files changed

+29
-2
lines changed

4 files changed

+29
-2
lines changed

src/BootstrapBlazor.Server/Components/Samples/Tutorials/BarCodeGenerator/BarCodeGenerator.razor

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
@namespace BootstrapBlazor.Server.Components.Samples.Tutorials
2+
@inject IStringLocalizer<BarCodeGenerator> Localizer
23
@page "/tutorials/barcode"
34

45
<div class="bc-main">
56
<div class="row g-3">
67
<div class="col-12 col-sm-6">
7-
<h5>选择一个类型</h5>
8+
<h5>@Localizer["SelectType"]</h5>
89
<div class="bc-type-list">
910
@foreach (var item in _contents)
1011
{
@@ -63,7 +64,8 @@
6364
</div>
6465
</div>
6566
<div class="col-12 col-sm-6">
66-
<h5>预览</h5>
67+
<h5>@Localizer["Preview"]</h5>
68+
<p>@((MarkupString)_desc)</p>
6769
<div class="bc-qr-content">
6870
@if (!string.IsNullOrEmpty(_content))
6971
{

src/BootstrapBlazor.Server/Components/Samples/Tutorials/BarCodeGenerator/BarCodeGenerator.razor.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,15 @@ public partial class BarCodeGenerator
2626

2727
private string? _content;
2828

29+
private string _desc => _activeContentType switch
30+
{
31+
"Text" => Localizer["TextDesc"],
32+
"Url" => Localizer["UrlDesc"],
33+
"Wi-Fi" => Localizer["WiFiDesc"],
34+
"Email" => Localizer["EmailDesc"],
35+
_ => string.Empty
36+
};
37+
2938
private string? GetItemClassString(string item) => CssBuilder.Default("bc-type-item")
3039
.AddClass("active", _activeContentType == item)
3140
.Build();

src/BootstrapBlazor.Server/Locales/en-US.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7108,5 +7108,13 @@
71087108
"SubTitle": "An implementation TOTP RFC 6238 and HOTP RFC 4226 Authenticator service.",
71097109
"BaseUsageTitle": "Basic usage",
71107110
"BaseUsageIntro": "By calling the <code>Compute</code> method of the <code>ITotpService</code> service instance, you can get the password in the current time window. By calling the <code>Instance.GetRemainingSeconds</code> method, you can display the remaining validity time of the current password. In this example, the progress bar is used for dynamic display."
7111+
},
7112+
"BootstrapBlazor.Server.Components.Samples.Tutorials.BarCodeGenerator": {
7113+
"SelectType": "Select content type",
7114+
"Preview": "Preview",
7115+
"TextDesc": "Use your iPhone's camera or the QR code scanning function to scan the QR code below, then open the <code>Safari</code> browser and search for the current text using the default search engine.",
7116+
"UrlDesc": "Use your iPhone's camera or the QR code scanning function to scan the QR code below, then open the <code>Safari</code> browser and open the current address",
7117+
"WiFiDesc": "Use your iPhone's camera or the QR code scanner to scan the QR code below to automatically join the <code>WiFi</code> network.",
7118+
"EmailDesc": "Use your iPhone's camera or the QR code scanner to scan the QR code below, then open the <code>Email</code> app to send an email."
71117119
}
71127120
}

src/BootstrapBlazor.Server/Locales/zh-CN.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7108,5 +7108,13 @@
71087108
"SubTitle": "实现 TOTP RFC 6238 和 HOTP RFC 4226 认证器服务",
71097109
"BaseUsageTitle": "基本用法",
71107110
"BaseUsageIntro": "通过调用 <code>ITotpService</code> 服务实例方法 <code>Compute</code> 得到当前时间窗口内密码, 通过调用 <code>Instance.GetRemainingSeconds</code> 方法可以显示当前密码剩余有效时间,本例中通过进度条进行动态显示"
7111+
},
7112+
"BootstrapBlazor.Server.Components.Samples.Tutorials.BarCodeGenerator": {
7113+
"SelectType": "选择一个类型",
7114+
"Preview": "预览",
7115+
"TextDesc": "使用 <code>iPhone</code> 手机相机或者扫描二维码功能扫描下方二维码后,打开 <code>Safari</code> 浏览器使用默认搜索引擎搜索当前文本",
7116+
"UrlDesc": "使用 <code>iPhone</code> 手机相机或者扫描二维码功能扫描下方二维码后,打开 <code>Safari</code> 浏览器并且打开当前地址",
7117+
"WiFiDesc": "使用 <code>iPhone</code> 手机相机或者扫描二维码功能扫描下方二维码后,自动加入 <code>WiFi</code> 网络",
7118+
"EmailDesc": "使用 <code>iPhone</code> 手机相机或者扫描二维码功能扫描下方二维码后,打开 <code>Email</code> 应用发送邮件"
71117119
}
71127120
}

0 commit comments

Comments
 (0)