mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-20 18:29:33 -06:00
Refactor js translator to be able to share some code with the ajax version.
This commit is contained in:
@@ -1,18 +1,5 @@
|
||||
function updateTranslation (grammar, inputID, fromLangID, toLangID, outputID) {
|
||||
var input = document.getElementById(inputID).value;
|
||||
var fromLang = document.getElementById(fromLangID).value;
|
||||
var toLang = document.getElementById(toLangID).value;
|
||||
var output = document.getElementById(outputID);
|
||||
output.appendChild(formatTranslation(grammar.translate(input, fromLang, toLang)));
|
||||
}
|
||||
|
||||
function populateLangs (grammar, fromLang, toLang) {
|
||||
var f = document.getElementById(fromLang);
|
||||
var t = document.getElementById(toLang);
|
||||
for (var c in grammar.concretes) {
|
||||
addOption(f, c, c);
|
||||
addOption(t, c, c);
|
||||
}
|
||||
function addTranslation (outputID, translation) {
|
||||
document.getElementById(outputID).appendChild(formatTranslation(translation));
|
||||
}
|
||||
|
||||
function formatTranslation (outputs) {
|
||||
|
||||
Reference in New Issue
Block a user