diff --git a/src/core.js b/src/core.js index 8d828633cd9..cc9590adb4a 100644 --- a/src/core.js +++ b/src/core.js @@ -65,6 +65,11 @@ register([ require('./locale-en-us') ]); +// locales that are present in the window should be loaded +if(window.PlotlyLocales && window.PlotlyLocales.length) { + register(window.PlotlyLocales); +} + // plot icons exports.Icons = require('./fonts/ploticon'); diff --git a/tasks/util/wrap_locale.js b/tasks/util/wrap_locale.js index ddad20ba313..e2a106cb044 100644 --- a/tasks/util/wrap_locale.js +++ b/tasks/util/wrap_locale.js @@ -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 = ';