rusackas opened a new pull request, #34565:
URL: https://github.com/apache/superset/pull/34565
## Summary
- Fixed menu bar translations not updating when switching languages through
the language picker
- Converted Locale objects to strings for proper cache key hashing in
`cached_common_bootstrap_data`
- Added comprehensive unit tests to verify the fix
## Problem
When users changed the language using the language picker, most UI elements
would update but the menu bar items would remain in the previous language. This
was a known limitation where menu translations were cached incorrectly.
## Solution
The root cause was that the `cached_common_bootstrap_data` function was
using Flask-Babel's `Locale` objects directly as cache keys. These objects may
not hash consistently, causing cache misses. The fix:
1. Converts the `Locale` object to a string in `common_bootstrap_payload()`
before passing it to the cache function
2. Updates the cache function signature to accept string locales instead of
Locale objects
3. Parses the locale string to extract the language code for the bootstrap
data
## Test Plan
- [x] Added unit tests that verify:
- Locale objects are converted to strings before caching
- Different locale strings result in different cache entries
- Menu data is re-fetched when locale changes
- [x] All tests pass locally
- [x] Pre-commit checks pass
## Testing Instructions
1. Configure Superset with multiple languages (e.g., English and German)
2. Start the application and verify the menu is in the default language
3. Use the language picker to switch languages
4. Verify that menu items now update to the selected language
Fixes #34531
Generated with Claude Code
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]