Uh oh!
There was an error while loading. Please reload this page.
enables loading locales before Plotly - #4453
Conversation
| ]); | ||
| // locales that are present in the window should be loaded | ||
| if(window.PlotlyLocales && window.PlotlyLocales.length) { |
There was a problem hiding this comment.
if(window.PlotlyLocales&&Array.isArray(window.PlotlyLocales)){// ...}would be safer. Note that Plotly.register([]) is handled correctly (essentially a noop) at the moment.
etpinard
commented
Dec 30, 2019
This is an interesting solution. I'm not a fan of us polluting the window namespace once more with this new |
| // locales that are present in the window should be loaded | ||
| if(window.PlotlyLocales && window.PlotlyLocales.length) { | ||
| register(window.PlotlyLocales); |
There was a problem hiding this comment.
Maybe we could after this line have:
deletewindow.PlotlyLocales;to de-pollute the window namespaces after we're done registering the locales.
There was a problem hiding this comment.
Since it is a temporary variable, it may be better to add an underscore i.e. window._PlotlyLocales.
There was a problem hiding this comment.
Thanks for the suggestion! I'll let @etpinard choose between the different options (see also #4453 (comment))
There was a problem hiding this comment.
Wondering using sessionStorage may be a possibility?
antoinerg
commented
Dec 31, 2019
@etpinard Would you prefer me using a |
etpinard
commented
Jan 2, 2020
I forgot about |
alexcjohnson
commented
Jan 2, 2020
Only issue with using |
…indow.PlotlyLocales" This reverts commit b4b20a7.
antoinerg
commented
Jan 2, 2020
That's a very good point @alexcjohnson. I reverted b4b20a7 to use |
alexcjohnson
commented
Jan 2, 2020
I'm OK with |
etpinard
commented
Jan 2, 2020
Yeah, that's fine 👌 @antoinerg can you merge the latest master into your branch to get the syntax (header) tests to pass? |
etpinard
commented
Jan 2, 2020
Nicely done @antoinerg - 💃 ! |
This PR enables loading locales before plotly.js is on the page and partially fixes#4146.
In the following Codepens, we expect months to be in French (it should be
Maiinstead ofMay):Before
After