diff --git a/Source/Extensions/Blazorise.Components/Options/RouterTabsOptions.cs b/Source/Extensions/Blazorise.Components/Options/RouterTabsOptions.cs
index fe45234d1c..c16fcd28e4 100644
--- a/Source/Extensions/Blazorise.Components/Options/RouterTabsOptions.cs
+++ b/Source/Extensions/Blazorise.Components/Options/RouterTabsOptions.cs
@@ -9,7 +9,8 @@ public class RouterTabsOptions
{
///
/// Func used for localizing router tabs names.
- /// In: Name key, Out: Localized name
+ /// In: Name key, Out: Localized name.
+ /// Return null if localization isn't provided.
///
public Func NamesLocalizer { get; set; }
}
\ No newline at end of file
diff --git a/Source/Extensions/Blazorise.Components/RouterTabsPageAttribute.cs b/Source/Extensions/Blazorise.Components/RouterTabsPageAttribute.cs
index 27f43c511b..fc6f86cc75 100644
--- a/Source/Extensions/Blazorise.Components/RouterTabsPageAttribute.cs
+++ b/Source/Extensions/Blazorise.Components/RouterTabsPageAttribute.cs
@@ -10,7 +10,10 @@ namespace Blazorise.Components;
public class RouterTabsPageAttribute : Attribute
{
///
- /// Sets the name of the router tab.
+ /// Sets the name of the router tab.
+ /// The Name can be used as a key for the localization dictionary.
+ /// If left empty or null, RouteData.PageType
+ /// will be used as the Name.
///
public readonly string Name;
@@ -29,11 +32,6 @@ public class RouterTabsPageAttribute : Attribute
///
public readonly bool Closeable;
- ///
- /// Localization key for retrieving name of the tab
- ///
- public readonly string NameLocalizationKey;
-
public RouterTabsPageAttribute( string Name, string TabClass = "", string TabPanelClass = "", bool Closeable = true )
{
this.Name = Name;
@@ -41,13 +39,5 @@ public RouterTabsPageAttribute( string Name, string TabClass = "", string TabPan
this.TabPanelClass = TabPanelClass;
this.Closeable = Closeable;
}
-
- public RouterTabsPageAttribute( string NameLocalizationKey, bool Closeable = true, string TabClass = "", string TabPanelClass = "" )
- {
- this.NameLocalizationKey = NameLocalizationKey;
- this.TabClass = TabClass;
- this.TabPanelClass = TabPanelClass;
- this.Closeable = Closeable;
- }
}
\ No newline at end of file
diff --git a/Source/Extensions/Blazorise.Components/RouterTabsService.cs b/Source/Extensions/Blazorise.Components/RouterTabsService.cs
index aa725639e5..68c9cf8913 100644
--- a/Source/Extensions/Blazorise.Components/RouterTabsService.cs
+++ b/Source/Extensions/Blazorise.Components/RouterTabsService.cs
@@ -17,7 +17,6 @@ internal class RouterTabsItem
public string TabClass { get; set; }
public string TabPanelClass { get; set; }
public bool Closeable { get; set; } = true;
- public string NameLocalizationKey { get; set; }
public string LocalizedName { get; set; }
public string LocalizedNameOrName => LocalizedName ?? Name;
}
@@ -104,8 +103,7 @@ internal void TrySetRouteData( RouteData routeData )
if ( routeData is not null )
{
SetRouterTabsItemFromPageAttribute( routerTabsItem, routeData.PageType );
- if ( !string.IsNullOrWhiteSpace(routerTabsItem.NameLocalizationKey))
- routerTabsItem.LocalizedName = options?.NamesLocalizer.Invoke( routerTabsItem.NameLocalizationKey );
+ routerTabsItem.LocalizedName ??= options?.NamesLocalizer.Invoke( routerTabsItem.Name ) ;
routerTabsItem.Body ??= CreateRouterTabsItemBody( routeData );
routerTabsItem.TypeName = routeData.PageType.FullName;
if ( string.IsNullOrWhiteSpace( routerTabsItem.Name ) )
@@ -137,7 +135,6 @@ private void SetRouterTabsItemFromPageAttribute( RouterTabsItem pageItem, Type p
if ( routerTabsPageAttr is not null )
{
pageItem.Name = routerTabsPageAttr.Name;
- pageItem.NameLocalizationKey = routerTabsPageAttr.NameLocalizationKey;
pageItem.TabClass = routerTabsPageAttr.TabClass;
pageItem.TabPanelClass = routerTabsPageAttr.TabPanelClass;
pageItem.Closeable = routerTabsPageAttr.Closeable;