8000 enables loading locales before Plotly by antoinerg · Pull Request #4453 · plotly/plotly.js · GitHub
[go: up one dir, main page]

Skip to content

enables loading locales before Plotly #4453

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

Merged
merged 5 commits into from
Jan 2, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
locales: stash under window.PlotlyConfig.locales instead of window.Pl…
…otlyLocales
  • Loading branch information
antoinerg committed Jan 2, 2020
commit b4b20a7e562a8c0d03aad10a12fe535143e28dfa
6 changes: 3 additions & 3 deletions src/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ register([
]);

// locales that are present in the window should be loaded
if(window.PlotlyLocales && Array.isArray(window.PlotlyLocales)) {
register(window.PlotlyLocales);
delete window.PlotlyLocales;
if(window.PlotlyConfig && window.PlotlyConfig.locales) {
register(window.PlotlyConfig.locales);
delete window.PlotlyConfig.locales;
}

// plot icons
Expand Down
3 changes: 2 additions & 1 deletion tasks/util/wrap_locale.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ var intoStream = require('into-stream');
var constants = require('./constants');

var prefix = 'var locale=';
var suffix = ';if(typeof Plotly === \'undefined\') {window.PlotlyLocales = window.PlotlyLocales || []; window.PlotlyLocales.push(locale);} else {Plotly.register(locale);}';
var suffix = ';window.PlotlyConfig = window.PlotlyConfig || {};';
suffix += 'if(typeof Plotly === \'undefined\') {window.PlotlyConfig.locales = window.PlotlyConfig.locales || []; window.PlotlyConfig.locales.push(locale);} else {Plotly.register(locale);}';

var moduleMarker = 'module.exports = ';

Expand Down
0