2018-02-22 00:58:50 +08:00
|
|
|
<!DOCTYPE HTML>
|
|
|
|
<html>
|
|
|
|
|
|
|
|
<head>
|
2020-01-18 21:26:28 +08:00
|
|
|
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
|
2018-02-26 02:54:59 +08:00
|
|
|
<title>JSONEditor | Translate</title>
|
2018-02-22 00:58:50 +08:00
|
|
|
|
|
|
|
<link href="../dist/jsoneditor.css" rel="stylesheet" type="text/css">
|
2018-02-26 02:59:20 +08:00
|
|
|
<script src="../dist/jsoneditor.js"></script>
|
2018-02-22 00:58:50 +08:00
|
|
|
|
|
|
|
<style type="text/css">
|
|
|
|
#jsoneditor {
|
|
|
|
width: 500px;
|
|
|
|
height: 500px;
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
</head>
|
|
|
|
|
|
|
|
<body>
|
2019-08-29 21:45:32 +08:00
|
|
|
<p>
|
|
|
|
JSONEditor has support for multiple languages (i18n), in this case uses <code>pt-BR</code>.
|
|
|
|
</p>
|
|
|
|
<div id="jsoneditor"></div>
|
2018-02-22 00:58:50 +08:00
|
|
|
|
2019-08-29 21:45:32 +08:00
|
|
|
<script>
|
|
|
|
// create the editor
|
|
|
|
const container = document.getElementById('jsoneditor')
|
|
|
|
const options = {
|
|
|
|
// switch between pt-BR or en for testing forcing a language
|
|
|
|
// leave blank to get language
|
|
|
|
'language': 'pt-BR',
|
|
|
|
'languages': {
|
|
|
|
'pt-BR': {
|
|
|
|
'auto': 'Automático testing'
|
|
|
|
},
|
|
|
|
'en': {
|
|
|
|
'auto': 'Auto testing'
|
|
|
|
},
|
|
|
|
'newlang': {
|
|
|
|
'auto': 'Auto new lang'
|
2018-02-22 00:58:50 +08:00
|
|
|
}
|
2019-08-29 21:45:32 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
const editor = new JSONEditor(container, options)
|
2018-02-22 00:58:50 +08:00
|
|
|
|
2019-08-29 21:45:32 +08:00
|
|
|
const json = {
|
|
|
|
'array': [1, 2, 3],
|
|
|
|
'boolean': true,
|
|
|
|
'null': null,
|
|
|
|
'number': 123,
|
|
|
|
'object': { 'a': 'b', 'c': 'd' },
|
|
|
|
'string': 'Hello World'
|
|
|
|
}
|
|
|
|
editor.set(json)
|
|
|
|
</script>
|
2018-02-22 00:58:50 +08:00
|
|
|
</body>
|
|
|
|
|
|
|
|
</html>
|