Skip to content

Commit 6940aac

Browse files
committed
enable loading locales before Plotly
1 parent 0c4cebb commit 6940aac

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/core.js

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

68+
// locales that are present in the window should be loaded
69+
if(window.PlotlyLocales && window.PlotlyLocales.length) {
70+
register(window.PlotlyLocales);
71+
}
72+
6873
// plot icons
6974
exports.Icons = require('./fonts/ploticon');
7075

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)