Browse Source
feat: Add culture parameter to account, identity, user, setting, and tenant management pages for URL-based localization
pull/25174/head
maliming
20 hours ago
No known key found for this signature in database
GPG Key ID: A646B9CB645ECEA4
12 changed files with
25 additions and
3 deletions
docs/en/Community-Articles/2026-03-29-Url-Based-Localization/POST.md
docs/en/framework/fundamentals/url-based-localization.md
modules/account/src/Volo.Abp.Account.Blazor/Pages/Account/AccountManage.razor
modules/account/src/Volo.Abp.Account.Blazor/Pages/Account/AccountManage.razor.cs
modules/identity/src/Volo.Abp.Identity.Blazor/Pages/Identity/RoleManagement.razor
modules/identity/src/Volo.Abp.Identity.Blazor/Pages/Identity/RoleManagement.razor.cs
modules/identity/src/Volo.Abp.Identity.Blazor/Pages/Identity/UserManagement.razor
modules/identity/src/Volo.Abp.Identity.Blazor/Pages/Identity/UserManagement.razor.cs
modules/setting-management/src/Volo.Abp.SettingManagement.Blazor/Pages/SettingManagement/SettingManagement.razor
modules/setting-management/src/Volo.Abp.SettingManagement.Blazor/Pages/SettingManagement/SettingManagement.razor.cs
modules/tenant-management/src/Volo.Abp.TenantManagement.Blazor/Pages/TenantManagement/TenantManagement.razor
modules/tenant-management/src/Volo.Abp.TenantManagement.Blazor/Pages/TenantManagement/TenantManagement.razor.cs
@ -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
### Language switching uses forceLoad
@ -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
### 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.)?
### 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 chan ges.
No. ABP built-in module pages already ship with `@page "/{culture}/..."` route variants. You only need to add these routes to your own application pa ges.
@ -1,4 +1,5 @@
@page "/account/manage-profile"
@page "/account/manage-profile"
@page "/{culture}/account/manage-profile"
@using Microsoft.AspNetCore.Components.Forms
@using Microsoft.AspNetCore.Components.Forms
@using Volo.Abp.Account.Localization
@using Volo.Abp.Account.Localization
@using Volo.Abp.AspNetCore.Components.Web
@using Volo.Abp.AspNetCore.Components.Web
@ -8,6 +8,9 @@ namespace Volo.Abp.Account.Blazor.Pages.Account;
public partial class AccountManage
public partial class AccountManage
{
{
[Parameter]
public string? Culture { get ; set ; }
[Inject] protected IProfileAppService ProfileAppService { get ; set ; }
[Inject] protected IProfileAppService ProfileAppService { get ; set ; }
[Inject] protected IUiMessageService UiMessageService { get ; set ; }
[Inject] protected IUiMessageService UiMessageService { get ; set ; }
@ -1,4 +1,5 @@
@page "/identity/roles"
@page "/identity/roles"
@page "/{culture}/identity/roles"
@attribute [Authorize(IdentityPermissions.Roles.Default)]
@attribute [Authorize(IdentityPermissions.Roles.Default)]
@using Volo.Abp.Identity
@using Volo.Abp.Identity
@using Microsoft.AspNetCore.Authorization
@using Microsoft.AspNetCore.Authorization
@ -1,6 +1,7 @@
using System.Threading.Tasks ;
using System.Threading.Tasks ;
using Blazorise ;
using Blazorise ;
using Microsoft.AspNetCore.Authorization ;
using Microsoft.AspNetCore.Authorization ;
using Microsoft.AspNetCore.Components ;
using System ;
using System ;
using System.Collections.Generic ;
using System.Collections.Generic ;
using System.Threading.Tasks ;
using System.Threading.Tasks ;
@ -16,6 +17,9 @@ namespace Volo.Abp.Identity.Blazor.Pages.Identity;
public partial class RoleManagement
public partial class RoleManagement
{
{
[Parameter]
public string? Culture { get ; set ; }
protected const string PermissionProviderName = "R" ;
protected const string PermissionProviderName = "R" ;
protected PermissionManagementModal PermissionManagementModal ;
protected PermissionManagementModal PermissionManagementModal ;
@ -1,4 +1,5 @@
@page "/identity/users"
@page "/identity/users"
@page "/{culture}/identity/users"
@attribute [Authorize(IdentityPermissions.Users.Default)]
@attribute [Authorize(IdentityPermissions.Users.Default)]
@using Microsoft.AspNetCore.Authorization
@using Microsoft.AspNetCore.Authorization
@using Volo.Abp.PermissionManagement.Blazor.Components
@using Volo.Abp.PermissionManagement.Blazor.Components
@ -18,6 +18,9 @@ namespace Volo.Abp.Identity.Blazor.Pages.Identity;
public partial class UserManagement
public partial class UserManagement
{
{
[Parameter]
public string? Culture { get ; set ; }
protected const string PermissionProviderName = "U" ;
protected const string PermissionProviderName = "U" ;
protected const string DefaultSelectedTab = "UserInformations" ;
protected const string DefaultSelectedTab = "UserInformations" ;
@ -1,4 +1,5 @@
@page "/setting-management"
@page "/setting-management"
@page "/{culture}/setting-management"
@using Microsoft.AspNetCore.Authorization
@using Microsoft.AspNetCore.Authorization
@using Volo.Abp.AspNetCore.Components.Web.Theming.Layout
@using Volo.Abp.AspNetCore.Components.Web.Theming.Layout
@using Volo.Abp.Features
@using Volo.Abp.Features
@ -12,6 +12,9 @@ namespace Volo.Abp.SettingManagement.Blazor.Pages.SettingManagement;
public partial class SettingManagement
public partial class SettingManagement
{
{
[Parameter]
public string? Culture { get ; set ; }
[Inject]
[Inject]
protected IServiceProvider ServiceProvider { get ; set ; }
protected IServiceProvider ServiceProvider { get ; set ; }
@ -1,4 +1,5 @@
@page "/tenant-management/tenants"
@page "/tenant-management/tenants"
@page "/{culture}/tenant-management/tenants"
@attribute [Authorize(TenantManagementPermissions.Tenants.Default)]
@attribute [Authorize(TenantManagementPermissions.Tenants.Default)]
@using Microsoft.AspNetCore.Authorization
@using Microsoft.AspNetCore.Authorization
@using Volo.Abp.FeatureManagement.Blazor.Components
@using Volo.Abp.FeatureManagement.Blazor.Components
@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Threading.Tasks ;
using System.Threading.Tasks ;
using Blazorise ;
using Blazorise ;
using Microsoft.AspNetCore.Authorization ;
using Microsoft.AspNetCore.Authorization ;
using Microsoft.AspNetCore.Components ;
using Volo.Abp.AspNetCore.Components.Web.Extensibility.EntityActions ;
using Volo.Abp.AspNetCore.Components.Web.Extensibility.EntityActions ;
using Volo.Abp.AspNetCore.Components.Web.Extensibility.TableColumns ;
using Volo.Abp.AspNetCore.Components.Web.Extensibility.TableColumns ;
using Volo.Abp.AspNetCore.Components.Web.Theming.PageToolbars ;
using Volo.Abp.AspNetCore.Components.Web.Theming.PageToolbars ;
@ -14,6 +15,9 @@ namespace Volo.Abp.TenantManagement.Blazor.Pages.TenantManagement;
public partial class TenantManagement
public partial class TenantManagement
{
{
[Parameter]
public string? Culture { get ; set ; }
protected const string FeatureProviderName = "T" ;
protected const string FeatureProviderName = "T" ;
protected bool HasManageFeaturesPermission ;
protected bool HasManageFeaturesPermission ;