27 lines
1002 B
JavaScript
27 lines
1002 B
JavaScript
"use strict";
|
|
|
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
exports.changeConfirmLocale = changeConfirmLocale;
|
|
exports.getConfirmLocale = getConfirmLocale;
|
|
var _en_US = _interopRequireDefault(require("../locale/en_US"));
|
|
let runtimeLocale = Object.assign({}, _en_US.default.Modal);
|
|
let localeList = [];
|
|
const generateLocale = () => localeList.reduce((merged, locale) => Object.assign(Object.assign({}, merged), locale), _en_US.default.Modal);
|
|
function changeConfirmLocale(newLocale) {
|
|
if (newLocale) {
|
|
const cloneLocale = Object.assign({}, newLocale);
|
|
localeList.push(cloneLocale);
|
|
runtimeLocale = generateLocale();
|
|
return () => {
|
|
localeList = localeList.filter(locale => locale !== cloneLocale);
|
|
runtimeLocale = generateLocale();
|
|
};
|
|
}
|
|
runtimeLocale = Object.assign({}, _en_US.default.Modal);
|
|
}
|
|
function getConfirmLocale() {
|
|
return runtimeLocale;
|
|
} |