Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 29 additions & 10 deletions src/BootstrapBlazor.Server/Components/Samples/Client.razor
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@
<h4>@Localizer["SubTitle"]</h4>

<DemoBlock Title="@Localizer["BasicUsageTitle"]" Introduction="@Localizer["BasicUsageIntro"]" Name="Normal">
<p>@Localizer["BasicUsageP1"]</p>
<div class="mb-3">
<section ignore>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: The use of the 'ignore' attribute on

is non-standard HTML.

If 'ignore' is required for a custom directive or framework, confirm it is properly supported; otherwise, consider removing it to maintain HTML standards compliance.

<p>@Localizer["BasicUsageP1"]</p>
<p class="code-label">@((MarkupString)Localizer["BasicUsageP2"].Value)</p>
<Pre>public void Configure(IApplicationBuilder app)
{
// ...
// 增加下面这一行
// add this line
app.UseBootstrapBlazor();
app.UseEndpoints(endpoints =>
{
Expand All @@ -21,13 +22,11 @@
endpoints.MapFallbackToPage("/_Host");
});
}</Pre>
</div>

<Tips>
<p>@((MarkupString)Localizer["BasicUsageTips"].Value)</p>
</Tips>
<Tips>
<p>@((MarkupString)Localizer["BasicUsageTips"].Value)</p>
</Tips>

<div class="mb-3">
<p class="code-label">@((MarkupString)Localizer["BasicUsageP3"].Value)</p>
<Pre>[Inject]
[NotNull]
Expand All @@ -44,9 +43,29 @@ protected override async Task OnAfterRenderAsync(bool firstRender)
ClientInfo = await ClientService.GetClientInfo();
StateHasChanged();
}
}
</Pre>
</div>
}</Pre>

<p class="code-label">@((MarkupString)Localizer["BasicUsageP4"].Value)</p>
<p>@((MarkupString)Localizer["LocatorsProviderOptions"].Value)</p>
<p>@((MarkupString)Localizer["LocatorsProviderDesc1"].Value)</p>
<Pre>{
Comment on lines +49 to +51
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: The JSON snippet in the

 block is not properly closed.

Add the missing closing brace to the JSON example to prevent confusion for users copying it.

"BootstrapBlazorOptions": {
"WebClientOptions": {
"EnableIpLocator": true
}
}</Pre>
<p>@((MarkupString)Localizer["LocatorsProviderDesc2"].Value)</p>
<Pre>services.AddBootstrapBlazor(op =>
{
op.WebClientOptions.EnableIpLocator = true;
});</Pre>
<p>@((MarkupString)Localizer["LocatorsProviderDesc3"].Value)</p>
<Pre>services.Configure&lt;BootstrapBlazorOptions&gt;(op =>
{
op.WebClientOptions.EnableIpLocator = true;
});</Pre>

</section>
<GroupBox Title="@Localizer["GroupBoxTitle"]">
<p class="code-label">@Localizer["IpLocatorFactoryDesc"] <a href="locator" target="_blank">IpLocatorFactory</a></p>

Expand Down
3 changes: 3 additions & 0 deletions src/BootstrapBlazor.Server/Components/Samples/Locators.razor
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ Location = await provider.Locate(Ip);</Pre>
<p><code>183.160.236.53</code> @Localizer["LocatorsNormalTips4"]</p>

<DemoBlock Title="@Localizer["LocatorsNormalTitle"]" Introduction="@Localizer["LocatorsNormalIntro"]" Name="Normal">
<section ignore>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: Non-standard 'ignore' attribute used on

element.

If this attribute is for custom processing, confirm it's properly supported. Otherwise, it will be ignored by browsers and could be misleading.

@((MarkupString)Localizer["LocatorsProviderDesc"].Value)
</section>
<div class="row g-3 form-inline">
<div class="col-12 col-sm-6">
<Select Items="_providers" Value="@ProviderName" OnValueChanged="OnProviderNameChanged" ShowLabel="true" DisplayText="LocatorProvider">
Expand Down
8 changes: 6 additions & 2 deletions src/BootstrapBlazor.Server/Locales/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -3809,6 +3809,11 @@
"BasicUsageP2": "1. The <code>UseBootstrapBlazor</code> middleware in the <b>Startup.cs</b> file that client information collection is performed.",
"BasicUsageTips": "<code>app.UseBootstrapBlazor</code> Middleware is located assembly <code>BootstrapBlazor.Middleware</code>, please refer to this package yourself for proper use",
"BasicUsageP3": "2. The component uses the injection service <code>WebClientService</code> to call the <code>GetClientInfo</code> method.",
"BasicUsageP4": "3. Turn on IP geolocation",
"LocatorsProviderOptions": "<code>BootstrapBlazorOptions</code> section <code>WebClientOptions</code> By default it is <code>false</code>, which means the IP address location function is not enabled. Please change it to <code>true</code> in the configuration file or code.",
"LocatorsProviderDesc1": "Update the <code>appsetting.json</code> project configuration file",
"LocatorsProviderDesc2": "Or use the code to open",
"LocatorsProviderDesc3": "Or enable this function through configuration",
"GroupBoxTitle": "Connection information",
"IpLocatorFactoryDesc": "This service has built-in IP geolocation function. For detailed configuration and documentation, please refer to",
"Id": "Connection ID",
Expand Down Expand Up @@ -4103,8 +4108,7 @@
"LocatorsNormalInputText": "IpAddress",
"LocatorsNormalDisplayText": "Geographical location",
"LocatorsNormalButtonText": "Locating",
"LocatorsProviderDesc": "<p>The component library has two built-in free online geolocation locators, <code>BaiduIpLocatorProvider</code> <code>BaiduIpLocatorProviderV2</code><p><p>The component library has a built-in paid online geolocation locator <code>BootstrapBlazor.JuHeIpLocatorProvider</code> <a href=\"https://www.nuget.org/packages/BootstrapBlazor.JuHeIpLocatorProvider\" target=\"_blank\">Nuget package</a> <a href=\"https://juhe.cn\" target=\"_blank\">Official website address</a></p><p>The component library has a built-in free offline geolocation locator <code>BootstrapBlazor.IP2Region</code> <a href=\"https://www.nuget.org/packages/BootstrapBlazor.IP2Region\" target=\"_blank\">Nuget package</a></p>",
"LocatorsProviderOptions": "<code>BootstrapBlazorOptions</code> section <code>WebClientOptions</code> By default it is <code>false</code>, which means the IP address location function is not enabled. Please change it to <code>true</code> in the configuration file or code."
"LocatorsProviderDesc": "<p>The component library has two built-in free online geolocation locators, <code>BaiduIpLocatorProvider</code> <code>BaiduIpLocatorProviderV2</code><p><p>The component library has a built-in paid online geolocation locator <code>BootstrapBlazor.JuHeIpLocatorProvider</code> <a href=\"https://www.nuget.org/packages/BootstrapBlazor.JuHeIpLocatorProvider\" target=\"_blank\">Nuget package</a> <a href=\"https://juhe.cn\" target=\"_blank\">Official website address</a></p><p>The component library has a built-in free offline geolocation locator <code>BootstrapBlazor.IP2Region</code> <a href=\"https://www.nuget.org/packages/BootstrapBlazor.IP2Region\" target=\"_blank\">Nuget package</a></p>"
},
"BootstrapBlazor.Server.Components.Samples.Print": {
"PrintsTitle": "Print",
Expand Down
8 changes: 6 additions & 2 deletions src/BootstrapBlazor.Server/Locales/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -3809,6 +3809,11 @@
"BasicUsageP2": "1. <b>Startup.cs</b> 文件中使用 <code>UseBootstrapBlazor</code> 中间件进行客户端信息收集",
"BasicUsageTips": "<code>app.UseBootstrapBlazor</code> 中间件位于程序集 <code>BootstrapBlazor.Middleware</code>,请自行引用此包才能正常使用",
"BasicUsageP3": "2. 组件中使用注入服务 <code>WebClientService</code> 调用 <code>GetClientInfo</code> 方法",
"BasicUsageP4": "3. 开启 IP 地理位置定位功能",
"LocatorsProviderOptions": "全局配置定位器选项 <code>WebClientOptions</code> 默认 <code>false</code> 没有启用 IP 地址定位功能,请在配置文件中或者代码中更改为 <code>true</code>",
"LocatorsProviderDesc1": "更新 <code>appsetting.json</code> 项目配置文件",
"LocatorsProviderDesc2": "或者使用代码开启",
"LocatorsProviderDesc3": "或者通过配置开启本功能",
"GroupBoxTitle": "您的连接信息",
"IpLocatorFactoryDesc": "本服务已内置 IP 地理位置定位功能,详细配置与文档请参考",
"Id": "连接 ID",
Expand Down Expand Up @@ -4103,8 +4108,7 @@
"LocatorsNormalInputText": "Ip 地址",
"LocatorsNormalDisplayText": "地理位置",
"LocatorsNormalButtonText": "定位",
"LocatorsProviderDesc": "<p>组件库内置两个免费在线地理位置定位器分别为 <code>BaiduIpLocatorProvider</code> <code>BaiduIpLocatorProviderV2</code><p><p>组件库内置一个收费在线地理位置定位器 <code>BootstrapBlazor.JuHeIpLocatorProvider</code> <a href=\"https://www.nuget.org/packages/BootstrapBlazor.JuHeIpLocatorProvider\" target=\"_blank\">Nuget 包</a> <a href=\"https://juhe.cn\" target=\"_blank\">官网地址</a></p><p>组件库内置一个免费离线地理位置定位器 <code>BootstrapBlazor.IP2Region</code> <a href=\"https://www.nuget.org/packages/BootstrapBlazor.IP2Region\" target=\"_blank\">Nuget 包</a></p>",
"LocatorsProviderOptions": "全局配置定位器选项 <code>WebClientOptions</code> 默认 <code>false</code> 没有启用 IP 地址定位功能,请在配置文件中或者代码中更改为 <code>true</code>"
"LocatorsProviderDesc": "<p>组件库内置两个免费在线地理位置定位器分别为 <code>BaiduIpLocatorProvider</code> <code>BaiduIpLocatorProviderV2</code><p><p>组件库内置一个收费在线地理位置定位器 <code>BootstrapBlazor.JuHeIpLocatorProvider</code> <a href=\"https://www.nuget.org/packages/BootstrapBlazor.JuHeIpLocatorProvider\" target=\"_blank\">Nuget 包</a> <a href=\"https://juhe.cn\" target=\"_blank\">官网地址</a></p><p>组件库内置一个免费离线地理位置定位器 <code>BootstrapBlazor.IP2Region</code> <a href=\"https://www.nuget.org/packages/BootstrapBlazor.IP2Region\" target=\"_blank\">Nuget 包</a></p>"
},
"BootstrapBlazor.Server.Components.Samples.Print": {
"PrintsTitle": "Print 打印按钮",
Expand Down
Loading