Browse Source

Merge 0fb0c58152 into 541832d471

pull/8449/merge
Thomas Kaul 22 hours ago
committed by GitHub
parent
commit
558cf289a5
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 1
      CHANGELOG.md
  2. 44
      apps/client/src/app/adapter/custom-paginator-intl.ts
  3. 3
      apps/client/src/app/app.component.ts
  4. 6
      apps/client/src/main.ts

1
CHANGELOG.md

@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
- Fixed the duplicate data point of today in the chart of the holding detail dialog
- Fixed the missing localization of the range label in the paginator
## 3.100.0 - 2026-11-15

44
apps/client/src/app/adapter/custom-paginator-intl.ts

@ -0,0 +1,44 @@
import { getLocale } from '@ghostfolio/common/helper';
import { Service } from '@angular/core';
import { MatPaginatorIntl } from '@angular/material/paginator';
@Service()
export class CustomPaginatorIntl extends MatPaginatorIntl {
private locale = getLocale();
/**
* Formats the range label with the number format of the locale
*/
public override getRangeLabel = (
page: number,
pageSize: number,
length: number
) => {
let range = this.formatNumber(0);
if (length > 0 && pageSize > 0) {
const startIndex = page * pageSize;
const endIndex =
startIndex < length
? Math.min(startIndex + pageSize, length)
: startIndex + pageSize;
range = `${this.formatNumber(startIndex + 1)} – ${this.formatNumber(endIndex)}`;
}
const total = this.formatNumber(Math.max(length, 0));
return `${range} ${$localize`of`} ${total}`;
};
public setLocale(aLocale: string) {
this.locale = aLocale;
this.changes.next();
}
private formatNumber(aNumber: number) {
return aNumber.toLocaleString(this.locale, { useGrouping: true });
}
}

3
apps/client/src/app/app.component.ts

@ -42,6 +42,7 @@ import { openOutline } from 'ionicons/icons';
import { DeviceDetectorService } from 'ngx-device-detector';
import { distinctUntilChanged, filter, map } from 'rxjs/operators';
import { CustomPaginatorIntl } from './adapter/custom-paginator-intl';
import { GfFooterComponent } from './components/footer/footer.component';
import { GfHeaderComponent } from './components/header/header.component';
import { GfHoldingDetailDialogComponent } from './components/holding-detail-dialog/holding-detail-dialog.component';
@ -85,6 +86,7 @@ export class GfAppComponent implements OnInit {
ImpersonationStorageService
);
private readonly notificationService = inject(NotificationService);
private readonly paginatorIntl = inject(CustomPaginatorIntl);
private readonly route = inject(ActivatedRoute);
private readonly router = inject(Router);
private readonly title = inject(Title);
@ -225,6 +227,7 @@ export class GfAppComponent implements OnInit {
.subscribe((locale) => {
if (locale) {
this.dateAdapter.setLocale(locale);
this.paginatorIntl.setLocale(locale);
}
});

6
apps/client/src/main.ts

@ -18,6 +18,7 @@ import {
MAT_DATE_FORMATS,
MatNativeDateModule
} from '@angular/material/core';
import { MatPaginatorIntl } from '@angular/material/paginator';
import { MatSnackBarModule } from '@angular/material/snack-bar';
import { MatTooltipModule } from '@angular/material/tooltip';
import { bootstrapApplication } from '@angular/platform-browser';
@ -28,6 +29,7 @@ import { provideMarkdown } from 'ngx-markdown';
import { provideNgxSkeletonLoader } from 'ngx-skeleton-loader';
import { CustomDateAdapter } from './app/adapter/custom-date-adapter';
import { CustomPaginatorIntl } from './app/adapter/custom-paginator-intl';
import { DateFormats } from './app/adapter/date-formats';
import { GfAppComponent } from './app/app.component';
import { routes } from './app/app.routes';
@ -93,6 +95,10 @@ import { environment } from './environments/environment';
provide: MAT_DATE_FORMATS,
useValue: DateFormats
},
{
provide: MatPaginatorIntl,
useExisting: CustomPaginatorIntl
},
{
provide: TitleStrategy,
useClass: PageTitleStrategy

Loading…
Cancel
Save