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

* Improve localization

* Update changelog
pull/2604/head^2
Thomas Kaul 1 year ago committed by GitHub
parent 00342ca1f7
commit 6284b4dfe8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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

@ -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

@ -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' };
}
}

@ -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 {

Loading…
Cancel
Save