From dc5052f7dcb80dc1dcf48ad6fd8988ff6462d60e Mon Sep 17 00:00:00 2001
From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com>
Date: Tue, 16 Aug 2022 20:58:08 +0200
Subject: [PATCH] Feature/set up language localization for german (#1153)
* Set up language localization for German
* Update changelog
---
CHANGELOG.md | 1 +
apps/api/src/app/frontend.middleware.ts | 2 +
.../home-holdings/home-holdings.component.ts | 4 +-
.../home-overview/home-overview.component.ts | 4 +-
.../app/components/toggle/toggle.component.ts | 8 +++
apps/client/src/locales/messages.de.xlf | 72 ++++++++++++-------
apps/client/src/locales/messages.xlf | 35 +++++++++
libs/common/src/lib/config.ts | 10 ---
8 files changed, 97 insertions(+), 39 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index c6bf4596f..80932f728 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- Set up `ng-extract-i18n-merge` to improve the i18n extraction and merge workflow
+- Set up language localization for German (`de`)
### Changed
diff --git a/apps/api/src/app/frontend.middleware.ts b/apps/api/src/app/frontend.middleware.ts
index ffb3fd13b..bca60f8c9 100644
--- a/apps/api/src/app/frontend.middleware.ts
+++ b/apps/api/src/app/frontend.middleware.ts
@@ -10,6 +10,8 @@ export class FrontendMiddleware implements NestMiddleware {
if (req.path.startsWith('/api/') || this.isFileRequest(req.url)) {
// Skip
next();
+ } else if (req.path.startsWith('/de/')) {
+ res.sendFile(path.join(__dirname, '..', 'client', 'de', 'index.html'));
} else {
res.sendFile(
path.join(
diff --git a/apps/client/src/app/components/home-holdings/home-holdings.component.ts b/apps/client/src/app/components/home-holdings/home-holdings.component.ts
index a19d1746c..2065da3f1 100644
--- a/apps/client/src/app/components/home-holdings/home-holdings.component.ts
+++ b/apps/client/src/app/components/home-holdings/home-holdings.component.ts
@@ -2,6 +2,7 @@ import { ChangeDetectorRef, Component, OnDestroy, OnInit } from '@angular/core';
import { MatDialog } from '@angular/material/dialog';
import { ActivatedRoute, Router } from '@angular/router';
import { PositionDetailDialog } from '@ghostfolio/client/components/position/position-detail-dialog/position-detail-dialog.component';
+import { ToggleComponent } from '@ghostfolio/client/components/toggle/toggle.component';
import { DataService } from '@ghostfolio/client/services/data.service';
import { ImpersonationStorageService } from '@ghostfolio/client/services/impersonation-storage.service';
import {
@@ -9,7 +10,6 @@ import {
SettingsStorageService
} from '@ghostfolio/client/services/settings-storage.service';
import { UserService } from '@ghostfolio/client/services/user/user.service';
-import { defaultDateRangeOptions } from '@ghostfolio/common/config';
import { Position, User } from '@ghostfolio/common/interfaces';
import { hasPermission, permissions } from '@ghostfolio/common/permissions';
import { DateRange } from '@ghostfolio/common/types';
@@ -27,7 +27,7 @@ import { PositionDetailDialogParams } from '../position/position-detail-dialog/i
})
export class HomeHoldingsComponent implements OnDestroy, OnInit {
public dateRange: DateRange;
- public dateRangeOptions = defaultDateRangeOptions;
+ public dateRangeOptions = ToggleComponent.DEFAULT_DATE_RANGE_OPTIONS;
public deviceType: string;
public hasImpersonationId: boolean;
public hasPermissionToCreateOrder: boolean;
diff --git a/apps/client/src/app/components/home-overview/home-overview.component.ts b/apps/client/src/app/components/home-overview/home-overview.component.ts
index ddd2aafd0..f15099c2a 100644
--- a/apps/client/src/app/components/home-overview/home-overview.component.ts
+++ b/apps/client/src/app/components/home-overview/home-overview.component.ts
@@ -1,4 +1,5 @@
import { ChangeDetectorRef, Component, OnDestroy, OnInit } from '@angular/core';
+import { ToggleComponent } from '@ghostfolio/client/components/toggle/toggle.component';
import { DataService } from '@ghostfolio/client/services/data.service';
import { ImpersonationStorageService } from '@ghostfolio/client/services/impersonation-storage.service';
import {
@@ -6,7 +7,6 @@ import {
SettingsStorageService
} from '@ghostfolio/client/services/settings-storage.service';
import { UserService } from '@ghostfolio/client/services/user/user.service';
-import { defaultDateRangeOptions } from '@ghostfolio/common/config';
import {
PortfolioPerformance,
UniqueAsset,
@@ -26,7 +26,7 @@ import { takeUntil } from 'rxjs/operators';
})
export class HomeOverviewComponent implements OnDestroy, OnInit {
public dateRange: DateRange;
- public dateRangeOptions = defaultDateRangeOptions;
+ public dateRangeOptions = ToggleComponent.DEFAULT_DATE_RANGE_OPTIONS;
public deviceType: string;
public errors: UniqueAsset[];
public hasError: boolean;
diff --git a/apps/client/src/app/components/toggle/toggle.component.ts b/apps/client/src/app/components/toggle/toggle.component.ts
index dd5d6bbfc..a330e8af8 100644
--- a/apps/client/src/app/components/toggle/toggle.component.ts
+++ b/apps/client/src/app/components/toggle/toggle.component.ts
@@ -17,6 +17,14 @@ import { ToggleOption } from '@ghostfolio/common/types';
styleUrls: ['./toggle.component.scss']
})
export class ToggleComponent implements OnChanges, OnInit {
+ public static DEFAULT_DATE_RANGE_OPTIONS: ToggleOption[] = [
+ { label: $localize`Today`, value: '1d' },
+ { label: $localize`YTD`, value: 'ytd' },
+ { label: $localize`1Y`, value: '1y' },
+ { label: $localize`5Y`, value: '5y' },
+ { label: $localize`Max`, value: 'max' }
+ ];
+
@Input() defaultValue: string;
@Input() isLoading: boolean;
@Input() options: ToggleOption[];
diff --git a/apps/client/src/locales/messages.de.xlf b/apps/client/src/locales/messages.de.xlf
index ccb3b6e86..67b172079 100644
--- a/apps/client/src/locales/messages.de.xlf
+++ b/apps/client/src/locales/messages.de.xlf
@@ -557,6 +557,7 @@
+ Übersicht
apps/client/src/app/components/header/header.component.html
21
@@ -568,6 +569,7 @@
+ Portfolio
apps/client/src/app/components/header/header.component.html
32
@@ -583,6 +585,7 @@
+ Konten
apps/client/src/app/components/header/header.component.html
43
@@ -598,6 +601,7 @@
+ Administration
apps/client/src/app/components/header/header.component.html
55
@@ -609,6 +613,7 @@
+ Ressourcen
apps/client/src/app/components/header/header.component.html
66
@@ -639,6 +644,7 @@
+ Über
apps/client/src/app/components/header/header.component.html
91
@@ -2250,7 +2256,6 @@
- Oops! Incorrect Security Token.
apps/client/src/app/components/header/header.component.ts
126
@@ -2258,7 +2263,6 @@
- Do you really want to revoke this granted access?
apps/client/src/app/components/access-table/access-table.component.ts
49
@@ -2266,7 +2270,6 @@
- Do you really want to delete this account?
apps/client/src/app/components/accounts-table/accounts-table.component.ts
73
@@ -2274,7 +2277,6 @@
- Please add a currency:
apps/client/src/app/components/admin-overview/admin-overview.component.ts
106
@@ -2282,7 +2284,6 @@
- Do you really want to delete this coupon?
apps/client/src/app/components/admin-overview/admin-overview.component.ts
120
@@ -2290,7 +2291,6 @@
- Do you really want to delete this currency?
apps/client/src/app/components/admin-overview/admin-overview.component.ts
133
@@ -2298,7 +2298,6 @@
- Do you really want to flush the cache?
apps/client/src/app/components/admin-overview/admin-overview.component.ts
150
@@ -2306,7 +2305,6 @@
- Please set your system message:
apps/client/src/app/components/admin-overview/admin-overview.component.ts
199
@@ -2314,7 +2312,6 @@
- Do you really want to delete this user?
apps/client/src/app/components/admin-users/admin-users.component.ts
59
@@ -2322,7 +2319,6 @@
- Please enter the amount of your emergency fund:
apps/client/src/app/components/portfolio-summary/portfolio-summary.component.ts
48
@@ -2330,7 +2326,6 @@
- This feature is currently unavailable. Please try again later.
apps/client/src/app/core/http-response.interceptor.ts
59
@@ -2338,7 +2333,6 @@
- This feature requires a subscription.
apps/client/src/app/core/http-response.interceptor.ts
65
@@ -2346,7 +2340,6 @@
- Upgrade Plan
apps/client/src/app/core/http-response.interceptor.ts
67
@@ -2354,7 +2347,6 @@
- Oops! Something went wrong. Please try again later.
apps/client/src/app/core/http-response.interceptor.ts
84
@@ -2362,7 +2354,6 @@
- Okay
apps/client/src/app/core/http-response.interceptor.ts
85
@@ -2370,7 +2361,6 @@
- Please enter your coupon code:
apps/client/src/app/pages/account/account-page.component.ts
221
@@ -2378,7 +2368,6 @@
- Could not redeem coupon code
apps/client/src/app/pages/account/account-page.component.ts
231
@@ -2386,7 +2375,6 @@
- Coupon code has been redeemed
apps/client/src/app/pages/account/account-page.component.ts
243
@@ -2394,7 +2382,6 @@
- Reload
apps/client/src/app/pages/account/account-page.component.ts
244
@@ -2402,7 +2389,6 @@
- Do you really want to remove this sign in method?
apps/client/src/app/pages/account/account-page.component.ts
290
@@ -2410,7 +2396,6 @@
- As you are already logged in, you cannot access the demo account.
apps/client/src/app/pages/demo/demo-page.component.ts
31
@@ -2418,7 +2403,6 @@
- Importing data...
apps/client/src/app/pages/portfolio/transactions/transactions-page.component.ts
191
@@ -2426,7 +2410,6 @@
- Import has been completed
apps/client/src/app/pages/portfolio/transactions/transactions-page.component.ts
337
@@ -2434,12 +2417,51 @@
- Do you really want to delete this activity?
libs/ui/src/lib/activities-table/activities-table.component.ts
136
+
+
+ Heute
+
+ apps/client/src/app/components/toggle/toggle.component.ts
+ 21
+
+
+
+
+ YTD
+
+ apps/client/src/app/components/toggle/toggle.component.ts
+ 22
+
+
+
+
+ 1J
+
+ apps/client/src/app/components/toggle/toggle.component.ts
+ 23
+
+
+
+
+ 5J
+
+ apps/client/src/app/components/toggle/toggle.component.ts
+ 24
+
+
+
+
+ Max
+
+ apps/client/src/app/components/toggle/toggle.component.ts
+ 25
+
+