Formio-multiple-form-translate
HTML
<html>
<head>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css">
<link rel="stylesheet" href="https://unpkg.com/formiojs@latest/dist/formio.full.min.css">
<script src="https://unpkg.com/formiojs@latest/dist/formio.full.min.js"></script>
</head>
<body>
<div id="formio1"></div>
<br><br>
<div id="formio2"></div>
</body>
</html>
JavaScript
let json1 = {
"components": [{
"label": "Text Field",
"tableView": true,
"key": "textField",
"type": "textfield",
"input": true
},
{
"type": "button",
"label": "Submit",
"key": "submit",
"disableOnInvalid": true,
"input": true,
"tableView": false
}
]
};
let json2 = {
"components": [{
"label": "Name",
"tableView": true,
"key": "name",
"type": "textfield",
"input": true
},
{
"type": "button",
"label": "Apply",
"key": "apply",
"disableOnInvalid": true,
"input": true,
"tableView": false
}
]
};
window.onload = function() {
Formio.icons = 'fontawesome';
Formio.createForm(document.getElementById('formio1'), json1, {
"langauge": "fr",
"i18n": {
'resources': {
'fr': {
'translation': {
"Submit": "fr submit",
"Text Field": "fr text",
"Name": "fr name",
"Apply": "fr apply"
}
}
}
}
}).then(function(form){
form.language = 'fr';
});
Formio.createForm(document.getElementById('formio2'), json2, {
"langauge": "fr",
"i18n": {
'resources': {
'fr': {
'translation': {
"Name": "fr name",
"Apply": "fr apply"
}
}
}
}
}).then(function(form){
form.language = 'fr';
});
};