apache/superset

why I can not change my language??

q631599119 opened this issue ยท 14 comments

Bug description

image
image
image

Screenshots/recordings

No response

Superset version

master / latest-dev

Python version

3.10

Node version

18 or greater

Browser

Chrome

Additional context

No response

Checklist

  • I have searched Superset docs and Slack and didn't find a solution to my problem.
  • I have searched the GitHub issue tracker and didn't find a similar bug report.
  • I have checked Superset's logs for errors and if I found a relevant Python stacktrace, I included it here as text in the "additional context" section.

A similar issue was previously reported and closed. The suggested solution for users running Apache Superset with Docker is to add your LANGUAGES configuration to superset_config_docker.py instead of config.py. Additionally, it's important to clear all data in the site settings due to severe caching issues. For better language support, such as for Chinese, you can run the command pybabel compile -d superset/translations inside the Docker container [1].

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other

@dosu I do not use docker, How can I solve this problem?

To change the language in Apache Superset without using Docker, you need to modify the BABEL_DEFAULT_LOCALE setting in the superset/config.py file. For example, to change the language to Spanish, set:

BABEL_DEFAULT_LOCALE = "es"

Ensure that the language you choose is included in the LANGUAGES dictionary in the same configuration file. If the language is not listed, you may need to add it. Here are the available language options:

LANGUAGES = {
    "en": {"flag": "us", "name": "English"},
    "es": {"flag": "es", "name": "Spanish"},
    "it": {"flag": "it", "name": "Italian"},
    "fr": {"flag": "fr", "name": "French"},
    "zh": {"flag": "cn", "name": "Chinese"},
    "zh_TW": {"flag": "tw", "name": "Traditional Chinese"},
    "ja": {"flag": "jp", "name": "Japanese"},
    "de": {"flag": "de", "name": "German"},
    "pt": {"flag": "pt", "name": "Portuguese"},
    "pt_BR": {"flag": "br", "name": "Brazilian Portuguese"},
    "ru": {"flag": "ru", "name": "Russian"},
    "ko": {"flag": "kr", "name": "Korean"},
    "sk": {"flag": "sk", "name": "Slovak"},
    "sl": {"flag": "si", "name": "Slovenian"},
    "nl": {"flag": "nl", "name": "Dutch"},
    "uk": {"flag": "uk", "name": "Ukrainian"},
}

If you want to enable a language selection dropdown in the UI, ensure that the LANGUAGES dictionary is populated with more than one language option [1].

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other

@dosu I use superset_config.py , and I hava configure like you,but it does not work

After updating the language settings in superset_config.py, you may need to restart the Superset server to apply the changes. Additionally, clearing the browser cache can help ensure that the new settings are reflected in the UI. If the issue persists, verify that the LANGUAGES dictionary in your configuration file includes the desired language and that there are no syntax errors in the file.

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other

@dosu I have restarted and cleared my cache, but it does not work, do you have any other method?

Could you provide more details about your current setup? Specifically, it would be helpful to know:

  1. The exact changes you've made in the superset_config.py file.
  2. Any error messages or logs that might indicate what's going wrong.
  3. The operating system you're using.
  4. Whether you've tried accessing Superset from a different browser or device to see if the issue persists.

These details might help in identifying the problem.

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other

@dosu I have restarted and cleared my cache, but it does not work, do you have any other method?

If restarting and clearing the cache didn't resolve the issue, consider checking the following:

  1. Configuration File Location: Ensure that the superset_config.py file is in the correct location and is being loaded by Superset. You can verify this by adding a simple print statement or logging a message in the configuration file to confirm it's being executed.

  2. Cache Mechanisms: Superset uses caching mechanisms that might interfere with language changes. Check if there are any additional caching layers (like a reverse proxy or CDN) that might be serving cached content. You might need to clear these caches as well.

  3. Translation Files: Ensure that the translation files for the desired language are present in the BABEL_DEFAULT_FOLDER path specified in your configuration. If they are missing, you might need to generate or download them.

  4. Logs and Errors: Check the Superset logs for any warnings or errors related to language settings. This might provide clues if something is going wrong during the initialization.

  5. Browser and Network: Try accessing Superset from a different network or device to rule out any local caching issues.

If none of these steps resolve the issue, there might be a deeper configuration or environment-specific problem that requires further investigation.

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other

@dosu It seems no error
image

If there are no errors in the logs and the language settings still aren't applying, consider these additional steps:

  1. Verify Configuration Loading: Ensure that superset_config.py is being correctly loaded. You can add a debug statement in the file to confirm it's being executed. For example, add print("superset_config.py loaded") and check the server logs to see if this message appears.

  2. Check for Conflicting Settings: Double-check that there are no conflicting settings in other configuration files that might override your language settings.

  3. Translation Files: Make sure that the necessary translation files for the language you want are present and correctly compiled. You can manually compile them using the command pybabel compile -d superset/translations.

  4. Browser Language Settings: Sometimes, the browser's language settings can influence the language displayed. Ensure that your browser is set to the desired language.

  5. Network and Proxy Settings: If you're behind a proxy or using a VPN, try accessing Superset without it to rule out any network-related caching issues.

If these steps don't resolve the issue, it might be helpful to revisit the configuration and ensure all settings are correctly applied.

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other

@dosu How can I find other help? Maybe my problem is a little comflex?

This issue seems a bit complex, @rusackas, could you step in and help provide some insights?

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other

@rusackas could you step in and help me ?