From 362a974d0d26ceea7c5647c4bff861ee8157c615 Mon Sep 17 00:00:00 2001 From: Bastian Jakobi Date: Tue, 13 Aug 2024 09:15:26 +0200 Subject: [PATCH 1/2] fix: add length getter to DynamicLocaleId --- libs/angular-accelerator/src/lib/utils/dynamic-locale-id.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libs/angular-accelerator/src/lib/utils/dynamic-locale-id.ts b/libs/angular-accelerator/src/lib/utils/dynamic-locale-id.ts index 0f56872e..59974c63 100644 --- a/libs/angular-accelerator/src/lib/utils/dynamic-locale-id.ts +++ b/libs/angular-accelerator/src/lib/utils/dynamic-locale-id.ts @@ -15,4 +15,10 @@ export class DynamicLocaleId { valueOf() { return this.userService.lang$.getValue() } + + + public get length() : number { + return this.valueOf().length + } + } From 6d71a92c17407916a3487d285058344cce9ddb88 Mon Sep 17 00:00:00 2001 From: Bastian Jakobi Date: Tue, 13 Aug 2024 09:26:20 +0200 Subject: [PATCH 2/2] fix: fix test --- libs/angular-accelerator/src/lib/utils/dynamic-locale-id.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/angular-accelerator/src/lib/utils/dynamic-locale-id.ts b/libs/angular-accelerator/src/lib/utils/dynamic-locale-id.ts index 59974c63..29d87fc4 100644 --- a/libs/angular-accelerator/src/lib/utils/dynamic-locale-id.ts +++ b/libs/angular-accelerator/src/lib/utils/dynamic-locale-id.ts @@ -3,7 +3,7 @@ import { UserService } from '@onecx/angular-integration-interface' export class DynamicLocaleId { constructor(private userService: UserService) { Object.getOwnPropertyNames(String.prototype).forEach((k) => { - if (k != 'valueOf') { + if (k != 'valueOf' && k != 'length') { ;(this as any)[k] = function (...args: any[]) { const str = this.valueOf() return str[k](...args)