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
Section titled “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
Section titled “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>Applying translations
Section titled “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
Section titled “Available translations”| Language | Code/Filename | Global variable |
|---|---|---|
| AFRIKAANS | AF |
am4geodata_lang_AF |
| AMHARIC | AM |
am4geodata_lang_AM |
| ARABIC | AR |
am4geodata_lang_AR |
| AZERBAIJANI | AZ |
am4geodata_lang_AZ |
| BELARUSIAN | BE |
am4geodata_lang_BE |
| BULGARIAN | BG |
am4geodata_lang_BG |
| BENGALI | BN |
am4geodata_lang_BN |
| TIBETAN STANDARD | BO |
am4geodata_lang_BO |
| CATALAN | CA |
am4geodata_lang_CA |
| CZECH | CS |
am4geodata_lang_CS |
| WELSH | CY |
am4geodata_lang_CY |
| DANISH | DA |
am4geodata_lang_DA |
| GERMAN | DE |
am4geodata_lang_DE |
| EWE | EE |
am4geodata_lang_EE |
| GREEK | EL |
am4geodata_lang_EL |
| ENGLISH | EN |
am4geodata_lang_EN |
| ESPERANTO | EO |
am4geodata_lang_EO |
| SPANISH | ES |
am4geodata_lang_ES |
| ESTONIAN | ET |
am4geodata_lang_ET |
| BASQUE | EU |
am4geodata_lang_EU |
| PERSIAN | FA |
am4geodata_lang_FA |
| FINNISH | FI |
am4geodata_lang_FI |
| FAROESE | FO |
am4geodata_lang_FO |
| FRENCH | FR |
am4geodata_lang_FR |
| IRISH | GA |
am4geodata_lang_GA |
| GALICIAN | GL |
am4geodata_lang_GL |
| GUJARATI | GU |
am4geodata_lang_GU |
| HEBREW | HE |
am4geodata_lang_HE |
| HINDI | HI |
am4geodata_lang_HI |
| CROATIAN | HR |
am4geodata_lang_HR |
| HUNGARIAN | HU |
am4geodata_lang_HU |
| ARMENIAN | HY |
am4geodata_lang_HY |
| INTERLINGUA | IA |
am4geodata_lang_IA |
| INDONESIAN | ID |
am4geodata_lang_ID |
| ICELANDIC | IS |
am4geodata_lang_IS |
| ITALIAN | IT |
am4geodata_lang_IT |
| JAPANESE | JA |
am4geodata_lang_JA |
| GEORGIAN | KA |
am4geodata_lang_KA |
| KIKUYU | KI |
am4geodata_lang_KI |
| KHMER | KM |
am4geodata_lang_KM |
| KANNADA | KN |
am4geodata_lang_KN |
| KOREAN | KO |
am4geodata_lang_KO |
| GANDA | LG |
am4geodata_lang_LG |
| LAO | LO |
am4geodata_lang_LO |
| LITHUANIAN | LT |
am4geodata_lang_LT |
| LATVIAN | LV |
am4geodata_lang_LV |
| MACEDONIAN | MK |
am4geodata_lang_MK |
| MALAYALAM | ML |
am4geodata_lang_ML |
| MARATHI | MR |
am4geodata_lang_MR |
| MALAY | MS |
am4geodata_lang_MS |
| MALTESE | MT |
am4geodata_lang_MT |
| BURMESE | MY |
am4geodata_lang_MY |
| NORWEGIAN BOKMAL | NB |
am4geodata_lang_NB |
| NEPALI | NE |
am4geodata_lang_NE |
| DUTCH | NL |
am4geodata_lang_NL |
| NORWEGIAN NYNORSK | NN |
am4geodata_lang_NN |
| NORWEGIAN | NO |
am4geodata_lang_NO |
| ORIYA | OR |
am4geodata_lang_OR |
| POLISH | PL |
am4geodata_lang_PL |
| PORTUGUESE | PT |
am4geodata_lang_PT |
| ROMANSH | RM |
am4geodata_lang_RM |
| ROMANIAN | RO |
am4geodata_lang_RO |
| RUSSIAN | RU |
am4geodata_lang_RU |
| NORTHERN SAMI | SE |
am4geodata_lang_SE |
| SLOVAK | SK |
am4geodata_lang_SK |
| SLOVENE | SL |
am4geodata_lang_SL |
| SHONA | SN |
am4geodata_lang_SN |
| ALBANIAN | SQ |
am4geodata_lang_SQ |
| SERBIAN | SR |
am4geodata_lang_SR |
| SWEDISH | SV |
am4geodata_lang_SV |
| TAMIL | TA |
am4geodata_lang_TA |
| TELUGU | TE |
am4geodata_lang_TE |
| THAI | TH |
am4geodata_lang_TH |
| TIGRINYA | TI |
am4geodata_lang_TI |
| TAGALOG | TL |
am4geodata_lang_TL |
| TURKISH | TR |
am4geodata_lang_TR |
| UKRAINIAN | UK |
am4geodata_lang_UK |
| URDU | UR |
am4geodata_lang_UR |
| VIETNAMESE | VI |
am4geodata_lang_VI |
| CHINESE SIMPLIFIED | cn_ZH |
am4geodata_lang_cn_ZH |
| CHINESE TRADITIONAL | tw_ZH |
am4geodata_lang_tw_ZH |
Example
Section titled “Example”Credits
Section titled “Credits”The translations included in geodata language package is made from IP2Location™ Country Multilingual Database which available from https://www.ip2location.com.