Skip to content

Commit 34d5bc1

Browse files
update: breadcrumbs for url based localization
1 parent 9d0e040 commit 34d5bc1

3 files changed

Lines changed: 8 additions & 5 deletions

File tree

npm/ng-packs/packages/theme-shared/src/lib/components/breadcrumb-items/breadcrumb-items.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
}
1515

1616
<ng-template #linkTemplate let-item>
17-
<a [routerLink]="item.path"> {{ item.name | abpLocalization }}</a>
17+
<a [routerLink]="item.path | abpRouteCultureUrl"> {{ item.name | abpLocalization }}</a>
1818
</ng-template>
1919

2020
<ng-template #textTemplate let-item>

npm/ng-packs/packages/theme-shared/src/lib/components/breadcrumb-items/breadcrumb-items.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import { Component, input } from '@angular/core';
22
import { NgTemplateOutlet } from '@angular/common';
33
import { RouterLink } from '@angular/router';
4-
import { ABP, LocalizationPipe } from '@abp/ng.core';
4+
import { ABP, AbpRouteCultureUrlPipe, LocalizationPipe } from '@abp/ng.core';
55

66
@Component({
77
selector: 'abp-breadcrumb-items',
88
templateUrl: './breadcrumb-items.component.html',
9-
imports: [NgTemplateOutlet, RouterLink, LocalizationPipe],
9+
imports: [NgTemplateOutlet, RouterLink, LocalizationPipe, AbpRouteCultureUrlPipe],
1010
})
1111
export class BreadcrumbItemsComponent {
1212
readonly items = input<Partial<ABP.Route>[]>([]);

npm/ng-packs/packages/theme-shared/src/lib/components/breadcrumb/breadcrumb.component.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import {
22
ABP,
3-
getRoutePath,
3+
RouteBasedCultureUrlService,
44
RouterEvents,
55
RoutesService,
66
SubscriptionService,
@@ -25,14 +25,17 @@ export class BreadcrumbComponent implements OnInit {
2525
private routes = inject(RoutesService);
2626
private subscription = inject(SubscriptionService);
2727
private routerEvents = inject(RouterEvents);
28+
private routeCultureUrl = inject(RouteBasedCultureUrlService);
2829

2930
segments: Partial<ABP.Route>[] = [];
3031

3132
ngOnInit(): void {
3233
this.subscription.addOne(
3334
this.routerEvents.getNavigationEvents('End').pipe(
3435
startWith(null),
35-
map(() => this.routes.search({ path: getRoutePath(this.router) })),
36+
map(() =>
37+
this.routes.search({ path: this.routeCultureUrl.getRoutePathForMatching(this.router) }),
38+
),
3639
),
3740
route => {
3841
this.segments = [];

0 commit comments

Comments
 (0)