From d4b373d5c9597bbbdd613b6608b09eae196acd70 Mon Sep 17 00:00:00 2001 From: Bastian Jakobi <55296998+bastianjakobi@users.noreply.github.com> Date: Tue, 13 Aug 2024 09:34:20 +0200 Subject: [PATCH] fix: add length getter to DynamicLocaleId (#393) * fix: add length getter to DynamicLocaleId * fix: fix test --- .../src/lib/utils/dynamic-locale-id.ts | 8 +++++++- 1 file changed, 7 insertions(+), 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 0f56872e..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) @@ -15,4 +15,10 @@ export class DynamicLocaleId { valueOf() { return this.userService.lang$.getValue() } + + + public get length() : number { + return this.valueOf().length + } + }