Browse Source
Bugfix/country name localization (#7065)
* Fix country name localization
* Update changelog
pull/7068/head
Thomas Kaul
4 days ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with
20 additions and
28 deletions
-
CHANGELOG.md
-
apps/client/src/app/components/admin-market-data/asset-profile-dialog/asset-profile-dialog.component.ts
-
apps/client/src/app/components/admin-market-data/asset-profile-dialog/asset-profile-dialog.html
-
apps/client/src/app/components/holding-detail-dialog/holding-detail-dialog.component.ts
-
apps/client/src/app/components/holding-detail-dialog/holding-detail-dialog.html
-
apps/client/src/app/pages/portfolio/allocations/allocations-page.component.ts
-
apps/client/src/app/pages/resources/personal-finance-tools/product-page.component.ts
-
libs/common/src/lib/helper.ts
-
libs/ui/src/lib/world-map-chart/world-map-chart.component.ts
|
|
|
@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. |
|
|
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), |
|
|
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). |
|
|
|
|
|
|
|
## Unreleased |
|
|
|
|
|
|
|
### Fixed |
|
|
|
|
|
|
|
- Fixed an issue with the localization of the country names |
|
|
|
|
|
|
|
## 3.12.0 - 2026-06-17 |
|
|
|
|
|
|
|
### Changed |
|
|
|
|
|
|
|
@ -373,7 +373,7 @@ export class GfAssetProfileDialogComponent implements OnInit { |
|
|
|
) { |
|
|
|
for (const { code, weight } of this.assetProfile.countries) { |
|
|
|
this.countries[code] = { |
|
|
|
name: getCountryName({ code, locale: this.data.locale }), |
|
|
|
name: getCountryName({ code }), |
|
|
|
value: weight |
|
|
|
}; |
|
|
|
} |
|
|
|
|
|
|
|
@ -271,8 +271,7 @@ |
|
|
|
[locale]="data.locale" |
|
|
|
[value]=" |
|
|
|
getCountryName({ |
|
|
|
code: assetProfile?.countries[0].code, |
|
|
|
locale: data.locale |
|
|
|
code: assetProfile?.countries[0].code |
|
|
|
}) |
|
|
|
" |
|
|
|
>Country</gf-value |
|
|
|
|
|
|
|
@ -438,10 +438,7 @@ export class GfHoldingDetailDialogComponent implements OnInit { |
|
|
|
if (SymbolProfile?.countries?.length > 0) { |
|
|
|
for (const country of SymbolProfile.countries) { |
|
|
|
this.countries[country.code] = { |
|
|
|
name: getCountryName({ |
|
|
|
code: country.code, |
|
|
|
locale: this.data.locale |
|
|
|
}), |
|
|
|
name: getCountryName({ code: country.code }), |
|
|
|
value: country.weight |
|
|
|
}; |
|
|
|
} |
|
|
|
|
|
|
|
@ -274,8 +274,7 @@ |
|
|
|
[locale]="data.locale" |
|
|
|
[value]=" |
|
|
|
getCountryName({ |
|
|
|
code: SymbolProfile.countries[0].code, |
|
|
|
locale: data.locale |
|
|
|
code: SymbolProfile.countries[0].code |
|
|
|
}) |
|
|
|
" |
|
|
|
>Country</gf-value |
|
|
|
|
|
|
|
@ -399,10 +399,7 @@ export class GfAllocationsPageComponent implements OnInit { |
|
|
|
: position.valueInPercentage); |
|
|
|
} else { |
|
|
|
this.countries[code] = { |
|
|
|
name: getCountryName({ |
|
|
|
code, |
|
|
|
locale: this.user?.settings?.locale |
|
|
|
}), |
|
|
|
name: getCountryName({ code }), |
|
|
|
value: |
|
|
|
weight * |
|
|
|
(isNumber(position.valueInBaseCurrency) |
|
|
|
|
|
|
|
@ -33,7 +33,6 @@ export class GfProductPageComponent implements OnInit { |
|
|
|
) {} |
|
|
|
|
|
|
|
public ngOnInit() { |
|
|
|
const locale = document.documentElement.lang; |
|
|
|
const { subscriptionOffer } = this.dataService.fetchInfo(); |
|
|
|
|
|
|
|
this.price = subscriptionOffer?.price; |
|
|
|
@ -57,7 +56,7 @@ export class GfProductPageComponent implements OnInit { |
|
|
|
'Türkçe' |
|
|
|
], |
|
|
|
name: 'Ghostfolio', |
|
|
|
origin: getCountryName({ locale, code: 'CH' }), |
|
|
|
origin: getCountryName({ code: 'CH' }), |
|
|
|
regions: [$localize`Global`], |
|
|
|
slogan: 'Open Source Wealth Management', |
|
|
|
useAnonymously: true |
|
|
|
@ -70,10 +69,7 @@ export class GfProductPageComponent implements OnInit { |
|
|
|
}; |
|
|
|
|
|
|
|
if (this.product2.origin) { |
|
|
|
this.product2.origin = getCountryName({ |
|
|
|
locale, |
|
|
|
code: this.product2.origin |
|
|
|
}); |
|
|
|
this.product2.origin = getCountryName({ code: this.product2.origin }); |
|
|
|
} |
|
|
|
|
|
|
|
if (this.product2.regions) { |
|
|
|
|
|
|
|
@ -258,15 +258,13 @@ export function getCurrencyFromSymbol(aSymbol = '') { |
|
|
|
return aSymbol.replace(DEFAULT_CURRENCY, ''); |
|
|
|
} |
|
|
|
|
|
|
|
export function getCountryName({ |
|
|
|
code, |
|
|
|
locale = getLocale() |
|
|
|
}: { |
|
|
|
code: string; |
|
|
|
locale?: string; |
|
|
|
}): string { |
|
|
|
export function getCountryName({ code }: { code: string }): string { |
|
|
|
try { |
|
|
|
return new Intl.DisplayNames([locale], { type: 'region' }).of(code) ?? code; |
|
|
|
return ( |
|
|
|
new Intl.DisplayNames([document.documentElement.lang || locale], { |
|
|
|
type: 'region' |
|
|
|
}).of(code) ?? code |
|
|
|
); |
|
|
|
} catch { |
|
|
|
return code; |
|
|
|
} |
|
|
|
|
|
|
|
@ -95,7 +95,7 @@ export class GfWorldMapChartComponent implements OnChanges, OnDestroy { |
|
|
|
this.svgMapElement.options.countryNames = Object.keys( |
|
|
|
this.svgMapElement.countries |
|
|
|
).reduce<{ [code: string]: string }>((names, code) => { |
|
|
|
names[code] = getCountryName({ code, locale: this.locale }); |
|
|
|
names[code] = getCountryName({ code }); |
|
|
|
|
|
|
|
return names; |
|
|
|
}, {}); |
|
|
|
|