From 5ef6c13d8d1a303c761b6b9de15be2cfc5a02e81 Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Sun, 6 Jul 2025 10:49:52 +0200 Subject: [PATCH] Feature/improve language localization in users table of admin control panel (#5104) * Improve language localization * Update changelog --- CHANGELOG.md | 1 + .../components/admin-users/admin-users.component.ts | 9 +++++++-- .../src/app/components/admin-users/admin-users.html | 13 +++++++------ 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 13ac4771d..658bc8548 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +- Improved the language localization in the users table of the admin control panel - Renamed `Settings` to `settings` in the `User` database schema - Improved the language localization for Dutch (`nl`) - Improved the language localization for EspaƱol (`es`) diff --git a/apps/client/src/app/components/admin-users/admin-users.component.ts b/apps/client/src/app/components/admin-users/admin-users.component.ts index 962c0ffe1..01235a520 100644 --- a/apps/client/src/app/components/admin-users/admin-users.component.ts +++ b/apps/client/src/app/components/admin-users/admin-users.component.ts @@ -1,6 +1,10 @@ import { TokenStorageService } from '@ghostfolio/client/services/token-storage.service'; import { DEFAULT_PAGE_SIZE } from '@ghostfolio/common/config'; -import { getDateFormatString, getEmojiFlag } from '@ghostfolio/common/helper'; +import { + getDateFnsLocale, + getDateFormatString, + getEmojiFlag +} from '@ghostfolio/common/helper'; import { AdminUsers, InfoItem, User } from '@ghostfolio/common/interfaces'; import { hasPermission, permissions } from '@ghostfolio/common/permissions'; @@ -125,7 +129,8 @@ export class AdminUsersComponent implements OnDestroy, OnInit { public formatDistanceToNow(aDateString: string) { if (aDateString) { const distanceString = formatDistanceToNowStrict(parseISO(aDateString), { - addSuffix: true + addSuffix: true, + locale: getDateFnsLocale(this.user?.settings?.language) }); return Math.abs(differenceInSeconds(parseISO(aDateString), new Date())) < diff --git a/apps/client/src/app/components/admin-users/admin-users.html b/apps/client/src/app/components/admin-users/admin-users.html index 1a4125d84..c49258125 100644 --- a/apps/client/src/app/components/admin-users/admin-users.html +++ b/apps/client/src/app/components/admin-users/admin-users.html @@ -52,14 +52,15 @@ @if (element.subscription?.expiresAt) { }