Skip to content

Commit

Permalink
Merge pull request #4453 from plotly/script-order
Browse files Browse the repository at this point in the history
enables loading locales before Plotly
  • Loading branch information
antoinerg committed Jan 2, 2020
2 parents 968054c + 00aadd7 commit 4d88717
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions src/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@ register([
require('./locale-en-us')
]);

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

// plot icons
exports.Icons = require('./fonts/ploticon');

Expand Down
4 changes: 2 additions & 2 deletions tasks/util/wrap_locale.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ var intoStream = require('into-stream');

var constants = require('./constants');

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

var moduleMarker = 'module.exports = ';

Expand Down

0 comments on commit 4d88717

Please sign in to comment.