How to change language of python plotly express modebar?

Viewed 37

I have tried:

locale.setlocale(locale.LC_ALL , 'de_DE')

and

config = {
    'locale': 'de-DE'
}
fig.show(config=config)

But the modebar tooltips are still in English enter image description here

I saw that plotly.js has a translated version but in plotly.py I could not find it in the code...

1 Answers

According to the plotly documentation you need to register new languages.

In your case this means you need to add

https://cdn.plot.ly/plotly-locale-de-latest.js

to your dashboard.

You can do this either by adding

app.scripts.append_script({"external_url": "https://cdn.plot.ly/plotly-locale-de-latest.js"})

or by downloading the .js file and coping it to the assets folder in your dashboards root folder.

See https://dash.plot.ly/external-resources for more information.

Related