Browse Source

Feature/improve language localization in users table of admin control panel (#5104)

* Improve language localization

* Update changelog
pull/5106/head
Thomas Kaul 2 weeks ago
committed by GitHub
parent
commit
5ef6c13d8d
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 1
      CHANGELOG.md
  2. 9
      apps/client/src/app/components/admin-users/admin-users.component.ts
  3. 11
      apps/client/src/app/components/admin-users/admin-users.html

1
CHANGELOG.md

@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed ### Changed
- Improved the language localization in the users table of the admin control panel
- Renamed `Settings` to `settings` in the `User` database schema - Renamed `Settings` to `settings` in the `User` database schema
- Improved the language localization for Dutch (`nl`) - Improved the language localization for Dutch (`nl`)
- Improved the language localization for Español (`es`) - Improved the language localization for Español (`es`)

9
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 { TokenStorageService } from '@ghostfolio/client/services/token-storage.service';
import { DEFAULT_PAGE_SIZE } from '@ghostfolio/common/config'; 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 { AdminUsers, InfoItem, User } from '@ghostfolio/common/interfaces';
import { hasPermission, permissions } from '@ghostfolio/common/permissions'; import { hasPermission, permissions } from '@ghostfolio/common/permissions';
@ -125,7 +129,8 @@ export class AdminUsersComponent implements OnDestroy, OnInit {
public formatDistanceToNow(aDateString: string) { public formatDistanceToNow(aDateString: string) {
if (aDateString) { if (aDateString) {
const distanceString = formatDistanceToNowStrict(parseISO(aDateString), { const distanceString = formatDistanceToNowStrict(parseISO(aDateString), {
addSuffix: true addSuffix: true,
locale: getDateFnsLocale(this.user?.settings?.language)
}); });
return Math.abs(differenceInSeconds(parseISO(aDateString), new Date())) < return Math.abs(differenceInSeconds(parseISO(aDateString), new Date())) <

11
apps/client/src/app/components/admin-users/admin-users.html

@ -52,14 +52,15 @@
@if (element.subscription?.expiresAt) { @if (element.subscription?.expiresAt) {
<gf-premium-indicator <gf-premium-indicator
class="ml-1" class="ml-1"
i18n-title
[enableLink]="false" [enableLink]="false"
[title]=" [title]="
'Expires ' + `Expires ${formatDistanceToNow(
formatDistanceToNow(element.subscription.expiresAt) + element.subscription.expiresAt
' (' + )} (${
(element.subscription.expiresAt (element.subscription.expiresAt
| date: defaultDateFormat) + | date: defaultDateFormat)
')' })`
" "
/> />
} }

Loading…
Cancel
Save