Skip to content
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

jsFrontend.locale fixes #2850

Merged
merged 3 commits into from Jul 2, 2019

Conversation

Projects
None yet
2 participants
@StijnVrolijk
Copy link
Contributor

commented Jun 27, 2019

Type

  • Non critical bugfix

Pull request description

Previously, we assumed that, as soon as jsFrontend.locale.init() was executed, the locale would be available. Since jsFrontend.locale.init() runs an asynchronous ajax request that isn't the case.

This PR changes the code so we keep 'getting' the requested locale until the locale is actually initialized.

I've also added some other fixes that caused issues in browsers like Safari when the locale was not initialized. So they're no longer actually necessary but I've included them anyway as a sort of defensive programming addition.

@StijnVrolijk StijnVrolijk added this to the 5.6.0 milestone Jun 27, 2019

@StijnVrolijk StijnVrolijk requested review from forkcms/core-contributors Jun 27, 2019

StijnVrolijk added some commits Jun 27, 2019

Make sure the type exists before checking the key
Browsers like Safari don't like it when you do this.
Keep 'getting' locale until the locale is actually loaded
Previously, we assumed that, as soon as jsFrontend.locale.init() was
executed, the locale would be available. Since jsFrontend.locale.init()
runs an asynchronous ajax request that isn't the case.

This commit changes the code so we keep 'getting' the requested locale
until the locale is actually initialized

@StijnVrolijk StijnVrolijk force-pushed the frontend-locale-fix branch from f2c32da to 278e375 Jun 27, 2019

@carakas carakas merged commit 2aa9b1a into master Jul 2, 2019

5 checks passed

Scrutinizer No new issues
Details
continuous-integration/styleci/pr The analysis has passed
Details
continuous-integration/styleci/push The analysis has passed
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details

@carakas carakas deleted the frontend-locale-fix branch Jul 4, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.