Using map country name translations

By default the maps bundled with amCharts 4 include names of countries in English. This tutorial will show how you can use bundled translation files to translate them into a multitude of other languages.

Prerequisites

The techniques described in this tutorial rely on features introduced in specific versions of amCharts 4 and Geodata packaged. Make sure you have at least these versions before proceeding:

  • amCharts 4: 4.7.4
  • amCharts 4 Geodata: 4.1.8

Loading translation files

Translation files are included with the Geodata package, in a sub-directory lang.

Loading those will depend on your development environment:

import am4geodata_lang_ES from "@amcharts/amcharts4-geodata/lang/ES"; 
<script src="https://www.amcharts.com/lib/4/geodata/lang/ES.js"></script>

NOTE If you are using <script> tag to load translation data, global variables will be created, e.g. am4geodata_lang_ES. Much like with geodata itself.

Applying translations

Applying the translation is as easy as setting a single property on your MapChart:

chart.geodataNames = am4geodata_lang_ES;
chart.geodataNames = am4geodata_lang_ES;
{
  // ...
  geodataNames: am4geodata_lang_ES
}

That's all there is to it. Now the country names, will be shown in the language you loaded, rather than defaults contained in map files.

Available translations

LanguageCode/FilenameGlobal variable
AFRIKAANSAFam4geodata_lang_AF
AMHARICAMam4geodata_lang_AM
ARABICARam4geodata_lang_AR
AZERBAIJANIAZam4geodata_lang_AZ
BELARUSIANBEam4geodata_lang_BE
BULGARIANBGam4geodata_lang_BG
BENGALIBNam4geodata_lang_BN
TIBETAN STANDARDBOam4geodata_lang_BO
CATALANCAam4geodata_lang_CA
CZECHCSam4geodata_lang_CS
WELSHCYam4geodata_lang_CY
DANISHDAam4geodata_lang_DA
GERMANDEam4geodata_lang_DE
EWEEEam4geodata_lang_EE
GREEKELam4geodata_lang_EL
ENGLISHENam4geodata_lang_EN
ESPERANTOEOam4geodata_lang_EO
SPANISHESam4geodata_lang_ES
ESTONIANETam4geodata_lang_ET
BASQUEEUam4geodata_lang_EU
PERSIANFAam4geodata_lang_FA
FINNISHFIam4geodata_lang_FI
FAROESEFOam4geodata_lang_FO
FRENCHFRam4geodata_lang_FR
IRISHGAam4geodata_lang_GA
GALICIANGLam4geodata_lang_GL
GUJARATIGUam4geodata_lang_GU
HEBREWHEam4geodata_lang_HE
HINDIHIam4geodata_lang_HI
CROATIANHRam4geodata_lang_HR
HUNGARIANHUam4geodata_lang_HU
ARMENIANHYam4geodata_lang_HY
INTERLINGUAIAam4geodata_lang_IA
INDONESIANIDam4geodata_lang_ID
ICELANDICISam4geodata_lang_IS
ITALIANITam4geodata_lang_IT
JAPANESEJAam4geodata_lang_JA
GEORGIANKAam4geodata_lang_KA
KIKUYUKIam4geodata_lang_KI
KHMERKMam4geodata_lang_KM
KANNADAKNam4geodata_lang_KN
KOREANKOam4geodata_lang_KO
GANDALGam4geodata_lang_LG
LAOLOam4geodata_lang_LO
LITHUANIANLTam4geodata_lang_LT
LATVIANLVam4geodata_lang_LV
MACEDONIANMKam4geodata_lang_MK
MALAYALAMMLam4geodata_lang_ML
MARATHIMRam4geodata_lang_MR
MALAYMSam4geodata_lang_MS
MALTESEMTam4geodata_lang_MT
BURMESEMYam4geodata_lang_MY
NORWEGIAN BOKMALNBam4geodata_lang_NB
NEPALINEam4geodata_lang_NE
DUTCHNLam4geodata_lang_NL
NORWEGIAN NYNORSKNNam4geodata_lang_NN
NORWEGIANNOam4geodata_lang_NO
ORIYAORam4geodata_lang_OR
POLISHPLam4geodata_lang_PL
PORTUGUESEPTam4geodata_lang_PT
ROMANSHRMam4geodata_lang_RM
ROMANIANROam4geodata_lang_RO
RUSSIANRUam4geodata_lang_RU
NORTHERN SAMISEam4geodata_lang_SE
SLOVAKSKam4geodata_lang_SK
SLOVENESLam4geodata_lang_SL
SHONASNam4geodata_lang_SN
ALBANIANSQam4geodata_lang_SQ
SERBIANSRam4geodata_lang_SR
SWEDISHSVam4geodata_lang_SV
TAMILTAam4geodata_lang_TA
TELUGUTEam4geodata_lang_TE
THAITHam4geodata_lang_TH
TIGRINYATIam4geodata_lang_TI
TAGALOGTLam4geodata_lang_TL
TURKISHTRam4geodata_lang_TR
UKRAINIANUKam4geodata_lang_UK
URDUURam4geodata_lang_UR
VIETNAMESEVIam4geodata_lang_VI
CHINESE SIMPLIFIEDcn_ZHam4geodata_lang_cn_ZH
CHINESE TRADITIONALtw_ZHam4geodata_lang_tw_ZH

Example

See the Pen amCharts 4: MapChart with translated country names by amCharts team (@amcharts) on CodePen.

Credits

The translations included in geodata language package is made from IP2Location™ Country Multilingual Database which available from https://www.ip2location.com.