Localize amCharts labels


Would like to localize my charts.
How to use the “language” property of amCharts charts?
I understand that some language js file must be included, but can’t find out how.



Charts are localized by default using locale of the user. This language attribute is set automatically, so you do not need to set it explicitly. See com.haulmont.charts.web.gui.components.charts.amcharts.WebChart:121

If you want to change standard chart messages, such as day names, menus, am/pm, you can change them using your main messages pack.

# Override chart messages

menu.label.print = To printer
menu.label.save.image = Download me
menu.label.save.data = Save me

The complete list of locale keys defined in /charts-web-7.0.5.jar!/com/haulmont/charts/web/messages.properties.

By default AmCharts includes the following locale files (they work only as fallback, messages have priority over those JSON files):

If your users have correct locale in CUBA, language attribute will be set as language from Locale object.

Hi Yuriy

And debugging, that line …webchart:121 is hit and afterwards chart.getLanguage() gives “pt” (Portuguese) as it should.
Only problem is that I can´t get anything other than English names.
Well, I’m going to translate the keys.


Yes, messages have priority over those JSON files, it could be a problem. We try to localize everything using the same mechanism - messages files, so you do not need to learn every JS framework and its localization model.