Change the language in dash/plotly

I want to change the language of dash’s core components and the toolbar in plots (to german). I thought that defining external_scripts would be sufficient, but its still showing everything in english. Here is a minimal example of my code:

import dash 
import dash_core_components as dcc
import dash_html_components as html 
import plotly.express as px 
from datetime import datetime as dt


external_scripts = ["https://cdn.plot.ly/plotly-locale-de-latest.js"]
app = dash.Dash(__name__, external_scripts=external_scripts)

data_canada = px.data.gapminder().query("country == 'Canada'")
fig = px.bar(data_canada, x='year', y='pop')


app.layout = html.Div(children=[
    html.H1(children='Dashboard'),


    dcc.DatePickerRange(
        id="date_range_picker",
        min_date_allowed=dt(2018,1,1),
        max_date_allowed=dt(2020,12,31),
        display_format="MMM, YYYY"
    ),

    dcc.Graph(
        id='example-graph',
        figure=fig
    )
])

if __name__ == '__main__':
    app.run_server(debug=True)

What else do I have to do to change the language?

Answer

You must add:

config_plots = dict(locale=’de’)

to:

dcc.Graph(
    id='example-graph',
    figure=fig,
    config=config_plots
)