Skip to content

Commit cfd1268

Browse files
committed
doc: 实现本地化
1 parent 0353393 commit cfd1268

File tree

5 files changed

+76
-99
lines changed

5 files changed

+76
-99
lines changed
Lines changed: 30 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -1,123 +1,71 @@
11
@page "/install"
2-
@inject PackageVersionService VersionManager
32
@inject IStringLocalizer<Install> Localizer
43
@inject IOptions<WebsiteOptions> WebsiteOption
54

65
<h3>@Localizer["InstallTitle"]</h3>
76

8-
<h4>开始使用 BootstrapBlazor 进行更快、更舒服的 .NET Web 开发</h4>
7+
<h4>@Localizer["InstallDesc"]</h4>
98

10-
<p class="code-label">使用模板</p>
9+
<p class="code-label">@Localizer["Template"]</p>
1110

12-
<p>为了快速入门,您可以使用我们的 <code>dotnet</code> 模板。它们基于 Microsoft Web App 模板,但已修改为包含 <code>BootstrapBlazor</code> 组件,请查看 <a href="template">[传送门]</a></p>
11+
<p>@((MarkupString)Localizer["TemplateDesc"].Value)</p>
1312

14-
<p class="code-label">手动安装</p>
13+
<p class="code-label">@Localizer["Manual"]</p>
1514

16-
<p>如果您已经有一个项目并希望从默认模板或工作应用程序向其中添加 <code>BootstrapBlazor</code>。</p>
15+
<p>@((MarkupString)Localizer["ManualDesc"].Value)</p>
1716

18-
<p class="code-label">1. 安装包</p>
19-
<p>通过 <code>NuGet</code> 包管理器找到该包或使用以下命令安装它。</p>
17+
<p class="code-label">@Localizer["Step1"]</p>
18+
<p>@((MarkupString)Localizer["Step1Desc"].Value)</p>
2019
<Pre class="mb-3">dotnet add package BootstrapBlazor</Pre>
2120

22-
<p class="code-label">2. 添加导入</p>
23-
<p><code>_Imports.razor</code> 文件并添加一下内容</p>
21+
<p class="code-label">@Localizer["Step2"]</p>
22+
<p>@((MarkupString)Localizer["Step2Desc"].Value)</p>
2423
<Pre class="mb-3">@@using BootstrapBlazor.Components</Pre>
2524

26-
<p class="code-label">3. 添加引用</p>
27-
<p>将以下内容添加到您的 <code>HTML</code> 头部部分,它是 <code>App.razor</code> <code>_Layout.cshtml</code> <code>_Host.cshtml</code> <code>index.html</code>,取决于您运行的是 <code>Server</code> 还是 <code>WebAssembly</code></p>
25+
<p class="code-label">@Localizer["Step3"]</p>
26+
<p>@((MarkupString)Localizer["Step3Desc"].Value)</p>
2827
<Tab IsBorderCard="true" class="mb-3">
2928
<TabItem Text="NET10/NET9">
30-
<Pre>// FontAwesome 字体图标样式 注意需要引用 BootstrapBlazor.FontAwesome 包
29+
<Pre>@Localizer["FontAwesomeCss"]
3130
&lt;link rel="stylesheet" href="@@Assets["_content/BootstrapBlazor.FontAwesome/css/font-awesome.min.css"]" /&gt;
32-
// 组件样式已集成 Bootstrap 最新版
31+
@Localizer["BootstrapStyle"]
3332
&lt;link rel="stylesheet" href="@@Assets["_content/BootstrapBlazor/css/bootstrap.blazor.bundle.min.css"]" /&gt;
34-
// Motronic 主题可选建议添加
33+
@Localizer["MotronicDesc"]
3534
&lt;link rel="stylesheet" href="@@Assets["_content/BootstrapBlazor/css/motronic.min.css"]" /&gt;</Pre>
3635
</TabItem>
37-
<TabItem Text="其他">
38-
<Pre>// FontAwesome 字体图标样式 注意需要引用 BootstrapBlazor.FontAwesome 包
36+
<TabItem Text="@Localizer["OtherText"]">
37+
<Pre>@Localizer["FontAwesomeCss"]
3938
&lt;link rel="stylesheet" href="_content/BootstrapBlazor.FontAwesome/css/font-awesome.min.css" /&gt;
40-
// 组件样式已集成 Bootstrap 最新版
39+
@Localizer["BootstrapStyle"]
4140
&lt;link rel="stylesheet" href="_content/BootstrapBlazor/css/bootstrap.blazor.bundle.min.css" /&gt;
42-
// Motronic 主题可选建议添加
41+
@Localizer["MotronicDesc"]
4342
&lt;link rel="stylesheet" href="_content/BootstrapBlazor/css/motronic.min.css" /&gt;</Pre>
4443
</TabItem>
4544
</Tab>
4645

47-
<p class="code-label">4. 添加脚本</p>
48-
<p>结尾位置添加如下内容它应与默认 blazor 脚本位于同一位置</p>
46+
<p class="code-label">@Localizer["Step4"]</p>
47+
<p>@((MarkupString)Localizer["Step4Desc"].Value)</p>
4948
<Tab IsBorderCard="true" class="mb-3">
5049
<TabItem Text="NET10/NET9">
51-
<Pre>// 添加 BootstrapBlazor 脚本
52-
&lt;script src="@@Assets["_content/BootstrapBlazor/js/bootstrap.blazor.bundle.min.js"]"&gt;&lt;/script&gt;</Pre>
50+
<Pre>&lt;script src="@@Assets["_content/BootstrapBlazor/js/bootstrap.blazor.bundle.min.js"]"&gt;&lt;/script&gt;</Pre>
5351
</TabItem>
54-
<TabItem Text="其他">
55-
<Pre>// 添加 BootstrapBlazor 脚本
56-
&lt;script src="_content/BootstrapBlazor/js/bootstrap.blazor.bundle.min.js"&gt;&lt;/script&gt;</Pre>
52+
<TabItem Text="@Localizer["OtherText"]">
53+
<Pre>&lt;script src="_content/BootstrapBlazor/js/bootstrap.blazor.bundle.min.js"&gt;&lt;/script&gt;</Pre>
5754
</TabItem>
5855
</Tab>
5956

60-
<p class="code-label">5. 删除原 <code>Bootstrap</code> 资源</p>
61-
<p>删除 <code>bootstrap</code> 样式,请同时删除 <code>wwwroot</code> 文件夹下的 <code>bootstrap</code> 和 <code>open-iconic</code> 文件夹</p>
57+
<p class="code-label">@((MarkupString)Localizer["Step4"].Value)</p>
58+
<p>@((MarkupString)Localizer["Step4Desc"].Value)</p>
6259

63-
<p class="code-label">6. 注册服务</p>
64-
<p><code>Program.cs</code> 文件中注入 <code>BootstrapBlazor</code> 服务</p>
65-
<Pre class="mb-3">// 增加 BootstrapBlazor 服务
66-
builder.Services.AddBootstrapBlazor();</Pre>
60+
<p class="code-label">@Localizer["Step6"]</p>
61+
<p>@((MarkupString)Localizer["Step6Desc"].Value)</p>
62+
<Pre class="mb-3">builder.Services.AddBootstrapBlazor();</Pre>
6763

68-
<p class="code-label">7. 添加 <code>BootstrapBlazorRoot</code> 组件</p>
69-
<p>在母版页中添加 <code>BootstrapBlazorRoot</code> 组件</p>
64+
<p class="code-label">@((MarkupString)Localizer["Step7"].Value)</p>
65+
<p>@((MarkupString)Localizer["Step7Desc"].Value)</p>
7066
<Pre class="mb-3">&lt;BootstrapBlazorRoot&gt;
7167
&lt;Header&gt;&lt;/Header&gt;
7268
&lt;main&gt;
7369
@@Body
7470
&lt;/main&gt;
7571
&lt;/BootstrapBlazorRoot&gt;</Pre>
76-
77-
<p>@Localizer["GitP1"]</p>
78-
79-
<div class="row mb-sm-3">
80-
<div class="git col-12 col-sm-6 mb-3 mb-sm-0">
81-
<a class="git-fork" href="https://fork.dev/" target="_blank">
82-
<img alt="fork" src="@WebsiteOption.Value.GetAssetUrl("images/fork.png")" />
83-
<span>Fork</span>
84-
</a>
85-
</div>
86-
<div class="git col-12 col-sm-6 mb-3 mb-sm-0">
87-
<a href="https://tortoisegit.org/download/" target="_blank">
88-
<img alt="tortoisegit" src="@WebsiteOption.Value.GetAssetUrl("images/tortoisegit.svg")" />
89-
</a>
90-
</div>
91-
</div>
92-
93-
<p>@((MarkupString)Localizer["GitP2"].Value)</p>
94-
95-
<h4>@Localizer["NugetInstall"]</h4>
96-
97-
<PackageTips Name="BootstrapBlazor" />
98-
99-
<h4>@Localizer["EnvBuildTitle"]</h4>
100-
101-
<ol class="ul-demo">
102-
<li>@((MarkupString)Localizer["EnvLi1"].Value)</li>
103-
<li>@((MarkupString)Localizer["EnvLi2"].Value)</li>
104-
<li>@((MarkupString)string.Format(Localizer["EnvLi3"].Value, WebsiteOption.Value.GiteeRepositoryUrl))</li>
105-
</ol>
106-
107-
<Pre class="no-highlight">git clone @WebsiteOption.Value.GiteeRepositoryUrl</Pre>
108-
109-
@code {
110-
/// <summary>
111-
/// 获得/设置 版本号字符串
112-
/// </summary>
113-
private string Version { get; set; } = "fetching";
114-
115-
/// <summary>
116-
/// OnInitializedAsync 方法
117-
/// </summary>
118-
/// <returns></returns>
119-
protected override async Task OnInitializedAsync()
120-
{
121-
Version = await VersionManager.GetVersionAsync();
122-
}
123-
}

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

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1073,14 +1073,29 @@
10731073
},
10741074
"BootstrapBlazor.Server.Components.Pages.Install": {
10751075
"InstallTitle": "Install",
1076-
"GitP1": "There are many kinds of Git tools that everyone is familiar with, here I introduce two Git client tools",
1077-
"GitP2": "It is recommended to use the <a href='https://fork.dev'>Fork</a> tool to install, it can better and <a href='https://visualstudio.microsoft.com/vs/getting- started/' target='_blank'>Visual Studio</a> to use with development tools.",
1078-
"NugetInstall": "Nuget Install",
1079-
"NugetP1": "Use <a href='https://www.nuget.org/packages?q=BootstrapBlazor' target='_blank'>nuget.org</a> to install BootstrapBlazor components",
1080-
"EnvBuildTitle": "Project Environment Construction",
1081-
"EnvLi1": "Install .net core sdk <a href='https://www.microsoft.com/net/download' target='_blank'>Official Website</a>",
1082-
"EnvLi2": "Install Visual Studio and above <a href='https://visualstudio.microsoft.com/vs/getting-started' target='_blank'>Official website",
1083-
"EnvLi3": "Pull the project code BootstrapBlazor <a href='{0}' target='_blank'>Warehouse URL</a>"
1076+
"InstallDesc": "Getting started with BootstrapBlazor for faster and easier .NET web development.",
1077+
"Template": "Using Templates",
1078+
"TemplateDesc": "To get started quickly, you can use our <a href=\"template\">dotnet templates</a>. They're based on the Microsoft Web App template but have been modified to include BootstrapBlazor components.",
1079+
"Manual": "Manual Install",
1080+
"ManualDesc": "If you already have a project and want to add <code>BootstrapBlazor</code> to it, either from a default template or a working application.",
1081+
"Step1": "1. Install Package",
1082+
"Step1Desc": "Install the library through the <code>NuGet</code> Package Manager or with following command",
1083+
"Step2": "2. Add Imports",
1084+
"Step2Desc": "After the package is added, you need to add the following in your <code>_Imports.razor</code>",
1085+
"Step3": "3. Add References",
1086+
"Step3Desc": "Add the following to your HTML head section, it's either <code>index.html</code> or <code>_Layout.cshtml/_Host.cshtml/App.razor</code> depending on whether you're running WebAssembly or Server.",
1087+
"Step4": "4. Add Scripts",
1088+
"Step4Desc": "Next, add the <code>bootstrap.blazor.bundle.min.js</code> file next to the default Blazor script at the end",
1089+
"Step5": "5. Remove References",
1090+
"Step5Desc": "To delete the <code>bootstrap</code> style, please also delete the <code>bootstrap</code> and <code>open-iconic</code> folders in the <code>wwwroot</code> folder.",
1091+
"Step6": "6. Register Services",
1092+
"Step6Desc": "Add the following in <code>Program.cs</code>",
1093+
"Step7": "7. Add <code>BootstrapBlazorRoot</code> Component",
1094+
"Step7Desc": "Add the <code>BootstrapBlazorRoot</code> component to the Layout component",
1095+
"MotronicDesc": "// Motronic theme optional suggestion to add",
1096+
"BootstrapStyle": "// Component styles have been integrated with the latest version of Bootstrap",
1097+
"FontAwesomeCss": "// FontAwesome font icon style Note that you need to reference the BootstrapBlazor.FontAwesome package",
1098+
"OtherText": "Other"
10841099
},
10851100
"BootstrapBlazor.Server.Components.Components.Video": {
10861101
"H1": "B station related video link",

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

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1073,14 +1073,29 @@
10731073
},
10741074
"BootstrapBlazor.Server.Components.Pages.Install": {
10751075
"InstallTitle": "安装",
1076-
"GitP1": "Git 工具有很多种大家比较熟悉的,这里我介绍两款 Git 客户端工具",
1077-
"GitP2": "推荐使用 <a href='https://fork.dev'>Fork</a> 工具进行安装,它能更好地和 <a href='https://visualstudio.microsoft.com/vs/getting-started/' target='_blank'>Visual Studio</a> 开发工具配合使用。",
1078-
"NugetInstall": "Nuget 安装",
1079-
"NugetP1": "使用 <a href='https://www.nuget.org/packages?q=BootstrapBlazor' target='_blank'>nuget.org</a> 进行 BootstrapBlazor 组件的安装",
1080-
"EnvBuildTitle": "项目环境搭建",
1081-
"EnvLi1": "安装 .net core sdk <a href='https://www.microsoft.com/net/download' target='_blank'>官方网址</a>",
1082-
"EnvLi2": "安装 Visual Studio 最新版 <a href='https://visualstudio.microsoft.com/vs/getting-started' target='_blank'>官方网址</a>",
1083-
"EnvLi3": "拉取项目代码 BootstrapBlazor <a href='{0}' target='_blank'>仓库网址</a>"
1076+
"InstallDesc": "开始使用 BootstrapBlazor 进行更快、更舒服的 .NET Web 开发",
1077+
"Template": "使用模板",
1078+
"TemplateDesc": "为了快速入门,您可以使用我们的 <code>dotnet</code> 模板。它们基于 Microsoft Web App 模板,但已修改为包含 <code>BootstrapBlazor</code> 组件,请查看 <a href=\"template\">[传送门]</a>",
1079+
"Manual": "手动安装",
1080+
"ManualDesc": "如果您已经有一个项目并希望从默认模板或工作应用程序向其中添加 <code>BootstrapBlazor</code>。",
1081+
"Step1": "1. 安装包",
1082+
"Step1Desc": "通过 <code>NuGet</code> 包管理器找到该包或使用以下命令安装它。",
1083+
"Step2": "2. 添加导入",
1084+
"Step2Desc": "<code>_Imports.razor</code> 文件并添加一下内容",
1085+
"Step3": "3. 添加引用",
1086+
"Step3Desc": "将以下内容添加到您的 <code>HTML</code> 头部部分,它是 <code>App.razor</code> <code>_Layout.cshtml</code> <code>_Host.cshtml</code> <code>index.html</code>,取决于您运行的是 <code>Server</code> 还是 <code>WebAssembly</code>",
1087+
"Step4": "4. 添加脚本",
1088+
"Step4Desc": "结尾位置添加如下内容它应与默认 blazor 脚本位于同一位置",
1089+
"Step5": "5. 删除原 <code>Bootstrap</code> 资源",
1090+
"Step5Desc": "删除 <code>bootstrap</code> 样式,请同时删除 <code>wwwroot</code> 文件夹下的 <code>bootstrap</code> 和 <code>open-iconic</code> 文件夹",
1091+
"Step6": "6. 注册服务",
1092+
"Step6Desc": "<code>Program.cs</code> 文件中注入 <code>BootstrapBlazor</code> 服务",
1093+
"Step7": "7. 添加 <code>BootstrapBlazorRoot</code> 组件",
1094+
"Step7Desc": "在母版页中添加 <code>BootstrapBlazorRoot</code> 组件",
1095+
"MotronicDesc": "// Motronic 主题可选建议添加",
1096+
"BootstrapStyle": "// 组件样式已集成 Bootstrap 最新版",
1097+
"FontAwesomeCss": "// FontAwesome 字体图标样式 注意需要引用 BootstrapBlazor.FontAwesome 包",
1098+
"OtherText": "其他"
10841099
},
10851100
"BootstrapBlazor.Server.Components.Components.Video": {
10861101
"H1": "B 站相关视频链接",
-48.6 KB
Binary file not shown.

src/BootstrapBlazor.Server/wwwroot/images/tortoisegit.svg

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)