You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "xavier-GitHub76 (via GitHub)" <gi...@apache.org> on 2024/07/10 13:07:18 UTC
[I] Changing the language takes you to the list of users [superset]
xavier-GitHub76 opened a new issue, #29543:
URL: https://github.com/apache/superset/issues/29543
### Bug description
Whatever screen you are on, changing the language takes you to the list of users.
This is not logical, the current page should be updated and the most annoying thing is that any entries in progress (for example on the construction of a diagram) are lost
### How to reproduce the bug
Edit a chart
Change the language
The Users list is displayed, the chart edition is lost
### Screenshots/recordings
_No response_
### Superset version
master / latest-dev
### Python version
3.9
### Node version
16
### 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] Changing the language takes you to the list of users [superset]
Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on issue #29543:
URL: https://github.com/apache/superset/issues/29543#issuecomment-2221144944
Closing as a duplicate of https://github.com/apache/superset/issues/12768
--
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] Changing the language takes you to the list of users [superset]
Posted by "dosubot[bot] (via GitHub)" <gi...@apache.org>.
dosubot[bot] commented on issue #29543:
URL: https://github.com/apache/superset/issues/29543#issuecomment-2220484022
<!-- Answer -->
To fix the issue where changing the language redirects to the list of users and causes the current page to be lost along with any ongoing entries, you need to ensure that the language change does not trigger a full page reload or redirect. Instead, it should update the language in place.
One way to achieve this is by using client-side routing to handle the language change. This can be done by updating the URL with the new language parameter without causing a full page reload. Here is an example of how you can modify the language change handler to use client-side routing:
```tsx
import { useHistory } from 'react-router-dom';
// Assuming you have a function to change the language
const changeLanguage = (lang) => {
// Update the language in the application state
// ...
// Use client-side routing to update the URL without reloading the page
const history = useHistory();
history.push(`?lang=${lang}`);
};
// Example usage in a component
const LanguagePicker = () => {
const handleLanguageChange = (event) => {
const selectedLanguage = event.target.value;
changeLanguage(selectedLanguage);
};
return (
<select onChange={handleLanguageChange}>
<option value="en">English</option>
<option value="it">Italian</option>
{/* Add more languages as needed */}
</select>
);
};
```
In this example, the `changeLanguage` function updates the language in the application state and uses the `useHistory` hook from `react-router-dom` to update the URL with the new language parameter. This ensures that the language change does not cause a full page reload, preserving the current page and any ongoing entries <sup>[[1]](https://github.com/apache/superset/blob/master/superset-frontend/src/features/home/Menu.test.tsx)</sup>.
Additionally, ensure that the current language is stored and managed correctly within the application state. The current language is stored in the `locale_data` object under the `lang` key, and the default language configuration is set in the `superset/config.py` file using the `BABEL_DEFAULT_LOCALE` setting <sup>[[2]](https://github.com/apache/superset/blob/master/superset/translations/empty_language_pack.json)</sup><sup>[[3]](https://github.com/apache/superset/blob/master/superset/config.py)</sup>.
By implementing these changes, you can prevent the language change from redirecting to the list of users and ensure that ongoing entries are preserved.
<!-- Dosu Comment Footer -->
*To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
--
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] Changing the language takes you to the list of users [superset]
Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas closed issue #29543: Changing the language takes you to the list of users
URL: https://github.com/apache/superset/issues/29543
--
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