Feature/improve localization of fear and greed index (#2612)

* Improve localization

* Update changelog
This commit is contained in:
Thomas Kaul 2023-11-06 13:07:53 +01:00 committed by GitHub
parent 00342ca1f7
commit 6284b4dfe8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 7689 additions and 736 deletions

View File

@ -11,6 +11,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added a data migration to set `accountType` to `NULL` in the account database table
### Changed
- Improved the language localization for the _Fear & Greed Index_ (market mood)
- Improved the language localization for German (`de`)
## 2.18.0 - 2023-11-05
### Added

View File

@ -6,6 +6,7 @@ import {
OnInit
} from '@angular/core';
import { resolveFearAndGreedIndex } from '@ghostfolio/common/helper';
import { translate } from '@ghostfolio/ui/i18n';
@Component({
selector: 'gf-fear-and-greed-index',
@ -24,9 +25,9 @@ export class FearAndGreedIndexComponent implements OnChanges, OnInit {
public ngOnInit() {}
public ngOnChanges() {
const { emoji, text } = resolveFearAndGreedIndex(this.fearAndGreedIndex);
const { emoji, key } = resolveFearAndGreedIndex(this.fearAndGreedIndex);
this.fearAndGreedIndexEmoji = emoji;
this.fearAndGreedIndexText = text;
this.fearAndGreedIndexText = translate(key);
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -311,15 +311,15 @@ export function resetHours(aDate: Date) {
export function resolveFearAndGreedIndex(aValue: number) {
if (aValue <= 25) {
return { emoji: '🥵', text: 'Extreme Fear' };
return { emoji: '🥵', key: 'EXTREME_FEAR', text: 'Extreme Fear' };
} else if (aValue <= 45) {
return { emoji: '😨', text: 'Fear' };
return { emoji: '😨', key: 'FEAR', text: 'Fear' };
} else if (aValue <= 55) {
return { emoji: '😐', text: 'Neutral' };
return { emoji: '😐', key: 'NEUTRAL', text: 'Neutral' };
} else if (aValue < 75) {
return { emoji: '😜', text: 'Greed' };
return { emoji: '😜', key: 'GREED', text: 'Greed' };
} else {
return { emoji: '🤪', text: 'Extreme Greed' };
return { emoji: '🤪', key: 'EXTREME_GREED', text: 'Extreme Greed' };
}
}

View File

@ -57,7 +57,14 @@ const locales = {
Europe: $localize`Europe`,
'North America': $localize`North America`,
Oceania: $localize`Oceania`,
'South America': $localize`South America`
'South America': $localize`South America`,
// Fear and Greed Index
EXTREME_FEAR: $localize`Extreme Fear`,
EXTREME_GREED: $localize`Extreme Greed`,
FEAR: $localize`Fear`,
GREED: $localize`Greed`,
NEUTRAL: $localize`Neutral`
};
export function translate(aKey: string): string {