-
Notifications
You must be signed in to change notification settings - Fork 14.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#8294: Set moment library language during app setup #8296
Conversation
@kristw I've corrected mentioned issues. |
@oskarhinc some tests aren't always reliable; I restarted CI, check back in a while to see if it fixes the problem. |
@villebro Thanks a lot! |
superset/assets/src/preamble.js
Outdated
@@ -29,6 +29,7 @@ if (typeof window !== 'undefined') { | |||
if (bootstrapData.common && bootstrapData.common.language_pack) { | |||
const languagePack = bootstrapData.common.language_pack; | |||
configure({ languagePack }); | |||
localStorage.setItem('locale', bootstrapData.common.locale); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it produce the same result if you call moment.locale()
here without using localStorage
at all?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right - I've removed the usage of localStorage
now
Codecov Report
@@ Coverage Diff @@
## master #8296 +/- ##
==========================================
- Coverage 73.53% 67.74% -5.8%
==========================================
Files 115 451 +336
Lines 12396 22700 +10304
Branches 0 2370 +2370
==========================================
+ Hits 9116 15378 +6262
- Misses 3280 7185 +3905
- Partials 0 137 +137
Continue to review full report at Codecov.
|
CATEGORY
Choose one
SUMMARY
Make use of moment.locale method to change its language globally (as described in https://momentjs.com/docs/#/i18n/changing-locale/), when the app is set up (which is happening also on language change).
ADDITIONAL INFORMATION