Skip to content

Commit 4d88717

Browse files
authored
Merge pull request #4453 from plotly/script-order
enables loading locales before Plotly
2 parents 968054c + 00aadd7 commit 4d88717

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

Diff for: src/core.js

+6
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,12 @@ register([
6565
require('./locale-en-us')
6666
]);
6767

68+
// locales that are present in the window should be loaded
69+
if(window.PlotlyLocales && Array.isArray(window.PlotlyLocales)) {
70+
register(window.PlotlyLocales);
71+
delete window.PlotlyLocales;
72+
}
73+
6874
// plot icons
6975
exports.Icons = require('./fonts/ploticon');
7076

Diff for: tasks/util/wrap_locale.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ var intoStream = require('into-stream');
66

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

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

1212
var moduleMarker = 'module.exports = ';
1313

0 commit comments

Comments
 (0)