Browse Source

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

* Improve localization

* Update changelog
pull/2604/head^2
Thomas Kaul 11 months ago
committed by GitHub
parent
commit
6284b4dfe8
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      CHANGELOG.md
  2. 5
      apps/client/src/app/components/fear-and-greed-index/fear-and-greed-index.component.ts
  3. 1078
      apps/client/src/locales/messages.de.xlf
  4. 1078
      apps/client/src/locales/messages.es.xlf
  5. 1078
      apps/client/src/locales/messages.fr.xlf
  6. 1078
      apps/client/src/locales/messages.it.xlf
  7. 1078
      apps/client/src/locales/messages.nl.xlf
  8. 1078
      apps/client/src/locales/messages.pt.xlf
  9. 1070
      apps/client/src/locales/messages.tr.xlf
  10. 1062
      apps/client/src/locales/messages.xlf
  11. 10
      libs/common/src/lib/helper.ts
  12. 9
      libs/ui/src/lib/i18n.ts

5
CHANGELOG.md

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

5
apps/client/src/app/components/fear-and-greed-index/fear-and-greed-index.component.ts

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

1078
apps/client/src/locales/messages.de.xlf

File diff suppressed because it is too large

1078
apps/client/src/locales/messages.es.xlf

File diff suppressed because it is too large

1078
apps/client/src/locales/messages.fr.xlf

File diff suppressed because it is too large

1078
apps/client/src/locales/messages.it.xlf

File diff suppressed because it is too large

1078
apps/client/src/locales/messages.nl.xlf

File diff suppressed because it is too large

1078
apps/client/src/locales/messages.pt.xlf

File diff suppressed because it is too large

1070
apps/client/src/locales/messages.tr.xlf

File diff suppressed because it is too large

1062
apps/client/src/locales/messages.xlf

File diff suppressed because it is too large

10
libs/common/src/lib/helper.ts

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

9
libs/ui/src/lib/i18n.ts

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