ant-design/index-with-locales.js
lijianan f6c235462e
chore: Remove locale-provider (#41289)
* chore: rm locale-receiver

* chore: export useLocale in locale

* chore: comment

* chore: rm locale-provider dir

* docs: rm locale-provider in migration document

* chore: fix regexp

---------

Co-authored-by: MadCcc <1075746765@qq.com>
2023-03-21 13:08:43 +08:00

13 lines
307 B
JavaScript

const antd = require('./components');
const req = require.context('./components', true, /^\.\/locale\/[A-Za-z]+_[A-Za-z]+\.tsx?$/);
antd.locales = {};
req.keys().forEach((mod) => {
const matches = mod.match(/\/([^/]+).tsx?$/);
antd.locales[matches[1]] = req(mod).default;
});
module.exports = antd;