Open-Federation / json-schema-editor-visual

A json-schema editor of high efficient and easy-to-use, base on React.
https://hellosean1025.github.io/json-schema-visual-editor/
MIT License
997 stars 220 forks source link

中文怎么配置? #70

Closed fortunatemouse closed 2 years ago

fortunatemouse commented 2 years ago

{lg: "zh_CN"} 是这样吗?

hellosean1025 commented 2 years ago

const SchemaEditor = schemaEditor({lg: "zh_CN"} )

fortunatemouse commented 2 years ago
import 'antd/dist/antd.css';
require('json-schema-editor-visual/dist/main.css');
const schemaEditor = require("json-schema-editor-visual/dist/main.js");
const SchemaEditor = schemaEditor({lg: "zh_CN"});
function App() {
  return (
      <SchemaEditor
        data={''}
        onChange={e => {
          console.log(JSON.parse(e));
        }}
      />
  );
}
export default App;

我的App.js文件是这样的,启动后组件显示的是英文。这个是用CRA构建的demo,是我引入的方式不对吗?

fortunatemouse commented 2 years ago

我在 json-schema-editor-visual/dist/main.js 文件中没有找到有关 “lg”的配置,但是我找到了一行代码: t.JSONPATH_JOIN_CHAR = ".", t.lang = "en_US", t.format = [{。 然后我把“lg”替换为“lang”。const SchemaEditor = schemaEditor({lang: "zh_CN"}); 中文可以正常显示了。

hellosean1025 commented 2 years ago

文档已修复