Browse Source

feat: Add culture parameter to account, identity, user, setting, and tenant management pages for URL-based localization

pull/25174/head
maliming 17 hours ago
parent
commit
cd478093ec
No known key found for this signature in database GPG Key ID: A646B9CB645ECEA4
  1. 2
      docs/en/Community-Articles/2026-03-29-Url-Based-Localization/POST.md
  2. 4
      docs/en/framework/fundamentals/url-based-localization.md
  3. 1
      modules/account/src/Volo.Abp.Account.Blazor/Pages/Account/AccountManage.razor
  4. 3
      modules/account/src/Volo.Abp.Account.Blazor/Pages/Account/AccountManage.razor.cs
  5. 1
      modules/identity/src/Volo.Abp.Identity.Blazor/Pages/Identity/RoleManagement.razor
  6. 4
      modules/identity/src/Volo.Abp.Identity.Blazor/Pages/Identity/RoleManagement.razor.cs
  7. 1
      modules/identity/src/Volo.Abp.Identity.Blazor/Pages/Identity/UserManagement.razor
  8. 3
      modules/identity/src/Volo.Abp.Identity.Blazor/Pages/Identity/UserManagement.razor.cs
  9. 1
      modules/setting-management/src/Volo.Abp.SettingManagement.Blazor/Pages/SettingManagement/SettingManagement.razor
  10. 3
      modules/setting-management/src/Volo.Abp.SettingManagement.Blazor/Pages/SettingManagement/SettingManagement.razor.cs
  11. 1
      modules/tenant-management/src/Volo.Abp.TenantManagement.Blazor/Pages/TenantManagement/TenantManagement.razor
  12. 4
      modules/tenant-management/src/Volo.Abp.TenantManagement.Blazor/Pages/TenantManagement/TenantManagement.razor.cs

2
docs/en/Community-Articles/2026-03-29-Url-Based-Localization/POST.md

@ -124,7 +124,7 @@ You must **manually** add the `{culture}` route to each of your own Blazor pages
}
```
> **ABP's built-in module pages** (Identity, Tenant Management, Settings, etc.) do **not** need this change. Language switching always uses `forceLoad: true`, which triggers a full HTTP request through the middleware pipeline. The `{culture}` route is only needed for direct URL access like `/zh-Hans/Products`.
> **ABP's built-in module pages** (Identity, Tenant Management, Settings, Account, etc.) already ship with `@page "/{culture}/..."` route variants. You only need to add these routes to your own application pages.
### Language switching uses forceLoad

4
docs/en/framework/fundamentals/url-based-localization.md

@ -138,7 +138,7 @@ Blazor Server uses SignalR (WebSocket) for the interactive circuit. The HTTP mid
}
````
> This applies to your own application pages. ABP built-in module pages (Identity, Tenant Management, etc.) do not need this change because language switching uses `forceLoad: true`, which always triggers a full HTTP request through the middleware pipeline.
> This applies to your own application pages. ABP built-in module pages (Identity, Tenant Management, Settings, Account, etc.) already include `@page "/{culture}/..."` routes out of the box — you do not need to add them manually.
### Example module configuration
@ -241,4 +241,4 @@ ASP.NET Core does not provide an `IPageRouteModelConvention` equivalent for Blaz
### Do I need to add `{culture}` routes to ABP module pages (Identity, Settings, etc.)?
No. Language switching in Blazor always uses `forceLoad: true`, which triggers a full HTTP request. The server-side middleware detects the culture from the URL path and sets the cookie. The interactive circuit then uses the cookie-based culture. Module pages work correctly without any changes.
No. ABP built-in module pages already ship with `@page "/{culture}/..."` route variants. You only need to add these routes to your own application pages.

1
modules/account/src/Volo.Abp.Account.Blazor/Pages/Account/AccountManage.razor

@ -1,4 +1,5 @@
@page "/account/manage-profile"
@page "/{culture}/account/manage-profile"
@using Microsoft.AspNetCore.Components.Forms
@using Volo.Abp.Account.Localization
@using Volo.Abp.AspNetCore.Components.Web

3
modules/account/src/Volo.Abp.Account.Blazor/Pages/Account/AccountManage.razor.cs

@ -8,6 +8,9 @@ namespace Volo.Abp.Account.Blazor.Pages.Account;
public partial class AccountManage
{
[Parameter]
public string? Culture { get; set; }
[Inject] protected IProfileAppService ProfileAppService { get; set; }
[Inject] protected IUiMessageService UiMessageService { get; set; }

1
modules/identity/src/Volo.Abp.Identity.Blazor/Pages/Identity/RoleManagement.razor

@ -1,4 +1,5 @@
@page "/identity/roles"
@page "/{culture}/identity/roles"
@attribute [Authorize(IdentityPermissions.Roles.Default)]
@using Volo.Abp.Identity
@using Microsoft.AspNetCore.Authorization

4
modules/identity/src/Volo.Abp.Identity.Blazor/Pages/Identity/RoleManagement.razor.cs

@ -1,6 +1,7 @@
using System.Threading.Tasks;
using Blazorise;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Components;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
@ -16,6 +17,9 @@ namespace Volo.Abp.Identity.Blazor.Pages.Identity;
public partial class RoleManagement
{
[Parameter]
public string? Culture { get; set; }
protected const string PermissionProviderName = "R";
protected PermissionManagementModal PermissionManagementModal;

1
modules/identity/src/Volo.Abp.Identity.Blazor/Pages/Identity/UserManagement.razor

@ -1,4 +1,5 @@
@page "/identity/users"
@page "/{culture}/identity/users"
@attribute [Authorize(IdentityPermissions.Users.Default)]
@using Microsoft.AspNetCore.Authorization
@using Volo.Abp.PermissionManagement.Blazor.Components

3
modules/identity/src/Volo.Abp.Identity.Blazor/Pages/Identity/UserManagement.razor.cs

@ -18,6 +18,9 @@ namespace Volo.Abp.Identity.Blazor.Pages.Identity;
public partial class UserManagement
{
[Parameter]
public string? Culture { get; set; }
protected const string PermissionProviderName = "U";
protected const string DefaultSelectedTab = "UserInformations";

1
modules/setting-management/src/Volo.Abp.SettingManagement.Blazor/Pages/SettingManagement/SettingManagement.razor

@ -1,4 +1,5 @@
@page "/setting-management"
@page "/{culture}/setting-management"
@using Microsoft.AspNetCore.Authorization
@using Volo.Abp.AspNetCore.Components.Web.Theming.Layout
@using Volo.Abp.Features

3
modules/setting-management/src/Volo.Abp.SettingManagement.Blazor/Pages/SettingManagement/SettingManagement.razor.cs

@ -12,6 +12,9 @@ namespace Volo.Abp.SettingManagement.Blazor.Pages.SettingManagement;
public partial class SettingManagement
{
[Parameter]
public string? Culture { get; set; }
[Inject]
protected IServiceProvider ServiceProvider { get; set; }

1
modules/tenant-management/src/Volo.Abp.TenantManagement.Blazor/Pages/TenantManagement/TenantManagement.razor

@ -1,4 +1,5 @@
@page "/tenant-management/tenants"
@page "/{culture}/tenant-management/tenants"
@attribute [Authorize(TenantManagementPermissions.Tenants.Default)]
@using Microsoft.AspNetCore.Authorization
@using Volo.Abp.FeatureManagement.Blazor.Components

4
modules/tenant-management/src/Volo.Abp.TenantManagement.Blazor/Pages/TenantManagement/TenantManagement.razor.cs

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Threading.Tasks;
using Blazorise;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Components;
using Volo.Abp.AspNetCore.Components.Web.Extensibility.EntityActions;
using Volo.Abp.AspNetCore.Components.Web.Extensibility.TableColumns;
using Volo.Abp.AspNetCore.Components.Web.Theming.PageToolbars;
@ -14,6 +15,9 @@ namespace Volo.Abp.TenantManagement.Blazor.Pages.TenantManagement;
public partial class TenantManagement
{
[Parameter]
public string? Culture { get; set; }
protected const string FeatureProviderName = "T";
protected bool HasManageFeaturesPermission;

Loading…
Cancel
Save