From cd478093eca5f4fd2ccdc50bc8c2bb50a5d453df Mon Sep 17 00:00:00 2001 From: maliming Date: Mon, 30 Mar 2026 11:18:38 +0800 Subject: [PATCH] feat: Add culture parameter to account, identity, user, setting, and tenant management pages for URL-based localization --- .../2026-03-29-Url-Based-Localization/POST.md | 2 +- docs/en/framework/fundamentals/url-based-localization.md | 4 ++-- .../Volo.Abp.Account.Blazor/Pages/Account/AccountManage.razor | 1 + .../Pages/Account/AccountManage.razor.cs | 3 +++ .../Pages/Identity/RoleManagement.razor | 1 + .../Pages/Identity/RoleManagement.razor.cs | 4 ++++ .../Pages/Identity/UserManagement.razor | 1 + .../Pages/Identity/UserManagement.razor.cs | 3 +++ .../Pages/SettingManagement/SettingManagement.razor | 1 + .../Pages/SettingManagement/SettingManagement.razor.cs | 3 +++ .../Pages/TenantManagement/TenantManagement.razor | 1 + .../Pages/TenantManagement/TenantManagement.razor.cs | 4 ++++ 12 files changed, 25 insertions(+), 3 deletions(-) diff --git a/docs/en/Community-Articles/2026-03-29-Url-Based-Localization/POST.md b/docs/en/Community-Articles/2026-03-29-Url-Based-Localization/POST.md index ec70ba02c7..afbc8461ed 100644 --- a/docs/en/Community-Articles/2026-03-29-Url-Based-Localization/POST.md +++ b/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 diff --git a/docs/en/framework/fundamentals/url-based-localization.md b/docs/en/framework/fundamentals/url-based-localization.md index 66e3f43cd2..ec28aeccf0 100644 --- a/docs/en/framework/fundamentals/url-based-localization.md +++ b/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. diff --git a/modules/account/src/Volo.Abp.Account.Blazor/Pages/Account/AccountManage.razor b/modules/account/src/Volo.Abp.Account.Blazor/Pages/Account/AccountManage.razor index 2341b9dc5b..c5ed90e5aa 100644 --- a/modules/account/src/Volo.Abp.Account.Blazor/Pages/Account/AccountManage.razor +++ b/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 diff --git a/modules/account/src/Volo.Abp.Account.Blazor/Pages/Account/AccountManage.razor.cs b/modules/account/src/Volo.Abp.Account.Blazor/Pages/Account/AccountManage.razor.cs index 1aef6551c2..7cc4e6e357 100644 --- a/modules/account/src/Volo.Abp.Account.Blazor/Pages/Account/AccountManage.razor.cs +++ b/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; } diff --git a/modules/identity/src/Volo.Abp.Identity.Blazor/Pages/Identity/RoleManagement.razor b/modules/identity/src/Volo.Abp.Identity.Blazor/Pages/Identity/RoleManagement.razor index 2dcaea5eac..2db9953cef 100644 --- a/modules/identity/src/Volo.Abp.Identity.Blazor/Pages/Identity/RoleManagement.razor +++ b/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 diff --git a/modules/identity/src/Volo.Abp.Identity.Blazor/Pages/Identity/RoleManagement.razor.cs b/modules/identity/src/Volo.Abp.Identity.Blazor/Pages/Identity/RoleManagement.razor.cs index 4e9a6576d1..485f2442d0 100644 --- a/modules/identity/src/Volo.Abp.Identity.Blazor/Pages/Identity/RoleManagement.razor.cs +++ b/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; diff --git a/modules/identity/src/Volo.Abp.Identity.Blazor/Pages/Identity/UserManagement.razor b/modules/identity/src/Volo.Abp.Identity.Blazor/Pages/Identity/UserManagement.razor index 28cb7f0bed..c54970bd33 100644 --- a/modules/identity/src/Volo.Abp.Identity.Blazor/Pages/Identity/UserManagement.razor +++ b/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 diff --git a/modules/identity/src/Volo.Abp.Identity.Blazor/Pages/Identity/UserManagement.razor.cs b/modules/identity/src/Volo.Abp.Identity.Blazor/Pages/Identity/UserManagement.razor.cs index fc35245801..ccce1cc363 100644 --- a/modules/identity/src/Volo.Abp.Identity.Blazor/Pages/Identity/UserManagement.razor.cs +++ b/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"; diff --git a/modules/setting-management/src/Volo.Abp.SettingManagement.Blazor/Pages/SettingManagement/SettingManagement.razor b/modules/setting-management/src/Volo.Abp.SettingManagement.Blazor/Pages/SettingManagement/SettingManagement.razor index ad571fb448..74d1a50b7d 100644 --- a/modules/setting-management/src/Volo.Abp.SettingManagement.Blazor/Pages/SettingManagement/SettingManagement.razor +++ b/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 diff --git a/modules/setting-management/src/Volo.Abp.SettingManagement.Blazor/Pages/SettingManagement/SettingManagement.razor.cs b/modules/setting-management/src/Volo.Abp.SettingManagement.Blazor/Pages/SettingManagement/SettingManagement.razor.cs index 1b443fc827..3a1697ca86 100644 --- a/modules/setting-management/src/Volo.Abp.SettingManagement.Blazor/Pages/SettingManagement/SettingManagement.razor.cs +++ b/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; } diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.Blazor/Pages/TenantManagement/TenantManagement.razor b/modules/tenant-management/src/Volo.Abp.TenantManagement.Blazor/Pages/TenantManagement/TenantManagement.razor index b7313b0c9a..49e4c64822 100644 --- a/modules/tenant-management/src/Volo.Abp.TenantManagement.Blazor/Pages/TenantManagement/TenantManagement.razor +++ b/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 diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.Blazor/Pages/TenantManagement/TenantManagement.razor.cs b/modules/tenant-management/src/Volo.Abp.TenantManagement.Blazor/Pages/TenantManagement/TenantManagement.razor.cs index 272bd9cf7a..c1fdbce867 100644 --- a/modules/tenant-management/src/Volo.Abp.TenantManagement.Blazor/Pages/TenantManagement/TenantManagement.razor.cs +++ b/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;