Browse Source

Localize country names

pull/6995/head
Thomas Kaul 3 days ago
parent
commit
ef32965e70
  1. 16
      libs/ui/src/lib/world-map-chart/world-map-chart.component.ts

16
libs/ui/src/lib/world-map-chart/world-map-chart.component.ts

@ -1,4 +1,8 @@
import { getLocale, getNumberFormatGroup } from '@ghostfolio/common/helper'; import {
getCountryName,
getLocale,
getNumberFormatGroup
} from '@ghostfolio/common/helper';
import { import {
ChangeDetectionStrategy, ChangeDetectionStrategy,
@ -25,7 +29,7 @@ export class GfWorldMapChartComponent implements OnChanges, OnDestroy {
@Input() locale = getLocale(); @Input() locale = getLocale();
public isLoading = true; public isLoading = true;
public svgMapElement; public svgMapElement: any;
public constructor(private changeDetectorRef: ChangeDetectorRef) {} public constructor(private changeDetectorRef: ChangeDetectorRef) {}
@ -88,6 +92,14 @@ export class GfWorldMapChartComponent implements OnChanges, OnDestroy {
targetElementID: 'svgMap' targetElementID: 'svgMap'
}); });
this.svgMapElement.options.countryNames = Object.keys(
this.svgMapElement.countries
).reduce<{ [code: string]: string }>((names, code) => {
names[code] = getCountryName({ code, locale: this.locale });
return names;
}, {});
setTimeout(() => { setTimeout(() => {
this.isLoading = false; this.isLoading = false;

Loading…
Cancel
Save