GitHub user dosubot[bot] added a comment to the discussion: superset 
localisation

<!-- Answer -->
To support different languages in Superset, you can follow these steps:

1. **Backend Configuration:**
   - Modify `superset/config.py` to include Babel configuration with 
`BABEL_DEFAULT_LOCALE`, `BABEL_DEFAULT_FOLDER`, and `LANGUAGES` settings.
   - Add the `LANGUAGES` variable to your `superset_config.py` to enable 
language selection in the UI. For example:
     ```python
     LANGUAGES = {
         'en': {'flag': 'us', 'name': 'English'},
         'fr': {'flag': 'fr', 'name': 'French'},
         'zh': {'flag': 'cn', 'name': 'Chinese'},
         'LANGUAGE_CODE': {'flag': 'flag_code', 'name': 'Language Name'},
     }
     ```
   - Use the following commands to initialize and update translation files:
     ```bash
     pybabel init -i superset/translations/messages.pot -d 
superset/translations -l LANGUAGE_CODE
     ./scripts/translations/babel_update.sh
     pybabel update -i superset/translations/messages.pot -d 
superset/translations --ignore-obsolete
     ```
   - Replace `LANGUAGE_CODE` with the code of the language you want to add 
<sup>[[1]](https://github.com/apache/superset/issues/31396)</sup><sup>[[2]](https://github.com/apache/superset/discussions/31444)</sup>.

2. **Frontend Configuration:**
   - Install dependencies and build translations:
     ```bash
     cd superset-frontend/ && npm ci
     npm run build-translation
     ```
   - The language picker functionality is available through the UI via 
`superset-frontend/src/features/home/LanguagePicker.tsx` 
<sup>[[1]](https://github.com/apache/superset/issues/31396)</sup>.

For configuring Helm charts to set environment variables for language 
selection, you can use the `extraEnv` or `extraSecretEnv` configuration 
options. For example:

```yaml
extraEnv:
  LANG: "en_US.UTF-8"
```

If the environment variable is sensitive, use `extraSecretEnv`:

```yaml
extraSecretEnv:
  LANG: "en_US.UTF-8"
```

These configurations will ensure that the specified environment variable is 
available in the Superset pods. You can reference these environment variables 
from `superset_config.py` using `os.environ.get("VAR")` 
<sup>[[3]](https://github.com/apache/superset/blob/master/helm/superset/README.md)</sup><sup>[[4]](https://github.com/apache/superset/blob/master/docs/docs/installation/kubernetes.mdx)</sup>.


<!-- Dosu Comment Footer -->
*To continue talking to [Dosu](https://dosu.dev), mention @dosu.*

---
<sup>Help Dosu learn! Give it feedback: [Great 
Response](https://app.dosu.dev/response-feedback/865bf004-4b9c-4719-99b0-a6a150576afd?feedback_type=great_response)
 | [Irrelevant 
Answer](https://app.dosu.dev/response-feedback/865bf004-4b9c-4719-99b0-a6a150576afd?feedback_type=irrelevant_answer)
 | [Incorrect 
Sources](https://app.dosu.dev/response-feedback/865bf004-4b9c-4719-99b0-a6a150576afd?feedback_type=incorrect_sources)
 | [Too 
Verbose](https://app.dosu.dev/response-feedback/865bf004-4b9c-4719-99b0-a6a150576afd?feedback_type=too_verbose)
 | 
[Hallucination](https://app.dosu.dev/response-feedback/865bf004-4b9c-4719-99b0-a6a150576afd?feedback_type=hallucination)
 | [Bug 
Report](https://app.dosu.dev/response-feedback/865bf004-4b9c-4719-99b0-a6a150576afd?feedback_type=bug_report)
 | 
[Other](https://app.dosu.dev/response-feedback/865bf004-4b9c-4719-99b0-a6a150576afd?feedback_type=other)</sup>


GitHub link: 
https://github.com/apache/superset/discussions/33005#discussioncomment-12732365

----
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