GitHub user pavelmalai added a comment to the discussion: Choose language for 
embedded dashboard

I had the same problem, implemented it by using a mutator:

Superset config file:


```
BABEL_DEFAULT_LOCALE = "en"
BABEL_DEFAULT_FOLDER = "superset/translations"
LANGUAGES = {
    "en": {"flag": "us", "name": "English"},
    "es": {"flag": "es", "name": "Spanish"}
}

def set_locale_from_url_param():
    from flask import session, request
    locale_param = request.args.get('lang')
    if locale_param:
        supported_locales = ['en', 'es']
        if locale_param in supported_locales:
            session["locale"] = locale_param

FLASK_APP_MUTATOR = lambda app: app.before_request(set_locale_from_url_param)
```


And when emedding the dashboard, add this url param to the dashboardUIConfig

```
dashboardUiConfig: {
       hideTitle: true,
       hideTab: true,
        filters: {
                expanded: false,
         },
          urlParams:{
                lang: 'es'
}
```

GitHub link: 
https://github.com/apache/superset/discussions/22536#discussioncomment-14253611

----
This is an automatically sent email for notifications@superset.apache.org.
To unsubscribe, please send an email to: 
notifications-unsubscr...@superset.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org
For additional commands, e-mail: notifications-h...@superset.apache.org

Reply via email to