You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "q631599119 (via GitHub)" <gi...@apache.org> on 2024/12/11 07:55:30 UTC
[I] Only part of the screen is in Chinese, the rest is in English [superset]
q631599119 opened a new issue, #31396:
URL: https://github.com/apache/superset/issues/31396
### Bug description

Only part of the screen is in Chinese, the rest is in English
### 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.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [I] Only part of the screen is in Chinese, the rest is in English [superset]
Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas closed issue #31396: Only part of the screen is in Chinese, the rest is in English
URL: https://github.com/apache/superset/issues/31396
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [I] Only part of the screen is in Chinese, the rest is in English [superset]
Posted by "q631599119 (via GitHub)" <gi...@apache.org>.
q631599119 commented on issue #31396:
URL: https://github.com/apache/superset/issues/31396#issuecomment-2535249552
@dosu the url is /lang/zh, where will it reach?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [I] Only part of the screen is in Chinese, the rest is in English [superset]
Posted by "dosubot[bot] (via GitHub)" <gi...@apache.org>.
dosubot[bot] commented on issue #31396:
URL: https://github.com/apache/superset/issues/31396#issuecomment-2534484696
<!-- Answer -->
The issue you're experiencing, where only part of the Apache Superset dashboard is in Chinese while the rest is in English, is likely due to incomplete translations in the `messages.po` file. This file contains both untranslated English strings and their Chinese translations, leading to a mixed-language interface <sup>[[1]](https://github.com/apache/superset/blob/master/superset/translations/zh/LC_MESSAGES/messages.po)</sup>.
To address this, you can update the translations by editing the `messages.po` file for Chinese, ensuring all necessary strings are translated. If you want to contribute to the translations, you can follow the process for updating or adding translations in the Apache Superset codebase, which involves using tools like `pybabel` to manage translation files <sup>[[2]](https://github.com/apache/superset/blob/master/docs/docs/contributing/contributing.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/1bf47300-faee-4419-8bb5-15b786f0dba0?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/1bf47300-faee-4419-8bb5-15b786f0dba0?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/1bf47300-faee-4419-8bb5-15b786f0dba0?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/1bf47300-faee-4419-8bb5-15b786f0dba0?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/1bf47300-faee-4419-8bb5-15b786f0dba0?feedback_type=hallucination) | [Other](https://app.dosu.dev/response-feedback/1bf47300-faee-4419-8bb5-15b786f0dba0?feedback_type=other)</sup>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [I] Only part of the screen is in Chinese, the rest is in English [superset]
Posted by "dosubot[bot] (via GitHub)" <gi...@apache.org>.
dosubot[bot] commented on issue #31396:
URL: https://github.com/apache/superset/issues/31396#issuecomment-2535188213
<!-- Answer -->
To resolve the placeholder errors in the `messages.po` file for Arabic translations, ensure that the placeholders in the `msgstr` entries match those in the `msgid` entries. For example, if the `msgid` contains `%(text)s`, the `msgstr` should also contain `%(text)s`.
Here is an example:
```po
#, python-format
msgid "\nError: %(text)s\n"
msgstr "\nخطأ: %(text)s\n"
```
Make sure all placeholders in the `msgid` are correctly mirrored in the `msgstr`. If there are any discrepancies, such as missing or mismatched placeholders, correct them to match exactly. This will resolve the placeholder errors when compiling the translations <sup>[[1]](https://github.com/apache/superset/blob/master/superset/translations/ar/LC_MESSAGES/messages.po)</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/d9281e99-6f68-433e-919a-db4934659e44?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/d9281e99-6f68-433e-919a-db4934659e44?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/d9281e99-6f68-433e-919a-db4934659e44?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/d9281e99-6f68-433e-919a-db4934659e44?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/d9281e99-6f68-433e-919a-db4934659e44?feedback_type=hallucination) | [Other](https://app.dosu.dev/response-feedback/d9281e99-6f68-433e-919a-db4934659e44?feedback_type=other)</sup>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [I] Only part of the screen is in Chinese, the rest is in English [superset]
Posted by "q631599119 (via GitHub)" <gi...@apache.org>.
q631599119 commented on issue #31396:
URL: https://github.com/apache/superset/issues/31396#issuecomment-2535094852
@dosu it does not work
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [I] Only part of the screen is in Chinese, the rest is in English [superset]
Posted by "q631599119 (via GitHub)" <gi...@apache.org>.
q631599119 commented on issue #31396:
URL: https://github.com/apache/superset/issues/31396#issuecomment-2534895363
@dosu how to use pybabel
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [I] Only part of the screen is in Chinese, the rest is in English [superset]
Posted by "dosubot[bot] (via GitHub)" <gi...@apache.org>.
dosubot[bot] commented on issue #31396:
URL: https://github.com/apache/superset/issues/31396#issuecomment-2535226490
<!-- Answer -->
The function that is triggered when changing the menu item in the `LanguagePicker` component is located in the file `superset-frontend/src/features/home/LanguagePicker.tsx`. This functionality is achieved by rendering a `SubMenu` component with `Menu.Item` elements for each language. Each `Menu.Item` contains a link (`<a>`) with the `href` attribute set to the URL of the language, which is how the language change is triggered:
```tsx
<Menu.Item
key={langKey}
style={{ whiteSpace: 'normal', height: 'auto' }}
>
<StyledLabel className="f16">
<i className={`flag ${languages[langKey].flag}`} />
<a href={languages[langKey].url}>{languages[langKey].name}</a>
</StyledLabel>
</Menu.Item>
```
This setup allows users to change the language by clicking on the respective language link, which navigates to the URL specified in the `languages` object <sup>[[1]](https://github.com/apache/superset/blob/master/superset-frontend/src/features/home/LanguagePicker.tsx)</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/36f0efe5-d380-43c3-8ad0-6cd2e678e423?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/36f0efe5-d380-43c3-8ad0-6cd2e678e423?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/36f0efe5-d380-43c3-8ad0-6cd2e678e423?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/36f0efe5-d380-43c3-8ad0-6cd2e678e423?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/36f0efe5-d380-43c3-8ad0-6cd2e678e423?feedback_type=hallucination) | [Other](https://app.dosu.dev/response-feedback/36f0efe5-d380-43c3-8ad0-6cd2e678e423?feedback_type=other)</sup>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [I] Only part of the screen is in Chinese, the rest is in English [superset]
Posted by "q631599119 (via GitHub)" <gi...@apache.org>.
q631599119 commented on issue #31396:
URL: https://github.com/apache/superset/issues/31396#issuecomment-2535223775
@dosu Change the menu Item, What file is the triggered function in? How was it achieved?
export default function LanguagePicker(props: LanguagePickerProps) {
const { locale, languages, ...rest } = props;
console.log('====================================');
console.log(languages);
console.log('====================================');
return (
<SubMenu
aria-label="Languages"
title={
<div className="f16">
<StyledFlag className={`flag ${languages[locale].flag}`} />
</div>
}
icon={<Icons.TriangleDown />}
{...rest}
>
{Object.keys(languages).map(langKey => (
<Menu.Item
key={langKey}
style={{ whiteSpace: 'normal', height: 'auto' }}
>
<StyledLabel className="f16">
<i className={`flag ${languages[langKey].flag}`} />
<a href={languages[langKey].url}>{languages[langKey].name}</a>
</StyledLabel>
</Menu.Item>
))}
</SubMenu>
);
}
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [I] Only part of the screen is in Chinese, the rest is in English [superset]
Posted by "dosubot[bot] (via GitHub)" <gi...@apache.org>.
dosubot[bot] commented on issue #31396:
URL: https://github.com/apache/superset/issues/31396#issuecomment-2535125921
<!-- Answer -->
If the `pybabel` process is not working as expected, it might be due to an issue documented in the Superset codebase. Specifically, `pybabel` doesn't extract plural forms from the frontend, which could affect the translation process <sup>[[1]](https://github.com/apache/superset/blob/master/superset-frontend/CHANGELOG.md)</sup>.
Make sure you are following the correct steps for updating and compiling translations. Here’s a quick checklist:
1. **Ensure Correct Extraction**: Verify that the `pybabel extract` command is correctly configured and executed. Check the `babel.cfg` file for any misconfigurations.
2. **Update Translations**: Run the `pybabel update` command to ensure that your `.po` files are updated with the latest strings from the `.pot` file.
3. **Compile Translations**: After making sure your `.po` files are correctly updated, compile them using `pybabel compile`.
4. **Check for Errors**: Look for any error messages during these processes that might indicate what’s going wrong.
If these steps are correctly followed and the issue persists, it might be necessary to check for any recent changes in the Superset codebase that could affect the translation process, such as changes in how translations are bundled or handled.
<!-- 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/7fc978aa-d517-4e2e-bb2d-983b5d70c9c9?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/7fc978aa-d517-4e2e-bb2d-983b5d70c9c9?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/7fc978aa-d517-4e2e-bb2d-983b5d70c9c9?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/7fc978aa-d517-4e2e-bb2d-983b5d70c9c9?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/7fc978aa-d517-4e2e-bb2d-983b5d70c9c9?feedback_type=hallucination) | [Other](https://app.dosu.dev/response-feedback/7fc978aa-d517-4e2e-bb2d-983b5d70c9c9?feedback_type=other)</sup>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [I] Only part of the screen is in Chinese, the rest is in English [superset]
Posted by "dosubot[bot] (via GitHub)" <gi...@apache.org>.
dosubot[bot] commented on issue #31396:
URL: https://github.com/apache/superset/issues/31396#issuecomment-2535252996
<!-- Answer -->
The URL `/lang/zh` in Superset is likely handled by the backend to change the application's language to Chinese. The specific handling of language routes is configured in the `superset/views/base.py` file, where the `menu_data` function constructs URLs for different languages using `appbuilder.get_url_for_locale(lang)`. This function generates language-specific URLs, allowing the application to manage multilingual support <sup>[[1]](https://github.com/apache/superset/blob/master/superset/views/base.py)</sup>.
However, the exact endpoint or function that processes the `/lang/zh` request in the backend is not explicitly detailed in the available information. It is likely part of the application's internationalization setup, which involves both frontend and backend components to ensure the language change is applied across the application.
<!-- 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/94692d59-1e21-4958-afd7-9afd231cec29?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/94692d59-1e21-4958-afd7-9afd231cec29?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/94692d59-1e21-4958-afd7-9afd231cec29?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/94692d59-1e21-4958-afd7-9afd231cec29?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/94692d59-1e21-4958-afd7-9afd231cec29?feedback_type=hallucination) | [Other](https://app.dosu.dev/response-feedback/94692d59-1e21-4958-afd7-9afd231cec29?feedback_type=other)</sup>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [I] Only part of the screen is in Chinese, the rest is in English [superset]
Posted by "q631599119 (via GitHub)" <gi...@apache.org>.
q631599119 commented on issue #31396:
URL: https://github.com/apache/superset/issues/31396#issuecomment-2535176162
@dosu 出现了下边的错误
(python-10-local-test) PS F:\LT\workspcae_new\superset-master> pybabel compile -d superset/translations
error: superset/translations\ar\LC_MESSAGES\messages.po:164: placeholders are incompatible
error: superset/translations\ar\LC_MESSAGES\messages.po:172: placeholders are incompatible
error: superset/translations\ar\LC_MESSAGES\messages.po:180: unknown named placeholder 'prefix'
error: superset/translations\ar\LC_MESSAGES\messages.po:343: placeholders are incompatible
error: superset/translations\ar\LC_MESSAGES\messages.po:1678: incompatible format for placeholder 1: 's' and 'd' are not compatible
error: superset/translations\ar\LC_MESSAGES\messages.po:2412: placeholders are incompatible
error: superset/translations\ar\LC_MESSAGES\messages.po:3580: placeholders are incompatible
error: superset/translations\ar\LC_MESSAGES\messages.po:3691: unknown named placeholder 'name'
error: superset/translations\ar\LC_MESSAGES\messages.po:5955: placeholders are incompatible
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [I] Only part of the screen is in Chinese, the rest is in English [superset]
Posted by "dosubot[bot] (via GitHub)" <gi...@apache.org>.
dosubot[bot] commented on issue #31396:
URL: https://github.com/apache/superset/issues/31396#issuecomment-2534936089
<!-- Answer -->
To use `pybabel` in the Apache Superset codebase, you can follow these steps:
1. **Extract Translations**: Use `pybabel extract` to extract translatable strings from the codebase. This command generates a `.pot` file containing all the strings that need translation.
```sh
pybabel extract -F superset/translations/babel.cfg -o superset/translations/messages.pot --no-location --sort-output --copyright-holder=Superset --project=Superset -k _ -k __ -k t -k tn:1,2 -k tct .
```
2. **Update Translations**: Use `pybabel update` to update the `.po` files with the new messages from the `.pot` file.
```sh
pybabel update -i superset/translations/messages.pot -d superset/translations --ignore-obsolete
```
3. **Compile Translations**: After translating the `.po` files, compile them into binary `.mo` files.
```sh
pybabel compile -d superset/translations
```
4. **Initialize New Language**: If you want to add a new language, use the `pybabel init` command with the appropriate language code.
```sh
pybabel init -i superset/translations/messages.pot -d superset/translations -l LANGUAGE_CODE
```
These steps are part of the process to manage translations in Superset using `pybabel`. The `babel_update.sh` script in the Superset repository automates many of these steps <sup>[[1]](https://github.com/apache/superset/blob/master/scripts/translations/babel_update.sh)</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/65d90a45-7dba-404c-9d06-cd23bd2da255?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/65d90a45-7dba-404c-9d06-cd23bd2da255?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/65d90a45-7dba-404c-9d06-cd23bd2da255?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/65d90a45-7dba-404c-9d06-cd23bd2da255?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/65d90a45-7dba-404c-9d06-cd23bd2da255?feedback_type=hallucination) | [Other](https://app.dosu.dev/response-feedback/65d90a45-7dba-404c-9d06-cd23bd2da255?feedback_type=other)</sup>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [I] Only part of the screen is in Chinese, the rest is in English [superset]
Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on issue #31396:
URL: https://github.com/apache/superset/issues/31396#issuecomment-2537445500
Hi there. Indeed, we don't consider incomplete translations to be bugs, but we do welcome additional contributions to the translation effort (basically, editing the `.po` files as documented [here](https://superset.apache.org/docs/contributing/howtos/#contributing-translations).)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org