mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-09 04:59:31 -06:00
Wide Coverage Translation Demo: improved performance
For improved performance, request only one translation from the server initially. When the user clicks on a translated sentense, request 9 more translations.
This commit is contained in:
@@ -98,6 +98,7 @@ wc.translate=function() {
|
||||
p.appendChild(span_class("pick "+q,pick))
|
||||
}
|
||||
}
|
||||
if(!so.got_more) p.appendChild(text("..."))
|
||||
/*
|
||||
p.appendChild(wrap_class("small","pick",
|
||||
node("a",{href:wc.google_translate_url(),
|
||||
@@ -112,6 +113,10 @@ wc.translate=function() {
|
||||
if(e) e.innerHTML=prob+"<br>"+(r.tree||"")
|
||||
if(wc.p /*&& so.rs.length>1*/) show_picks()
|
||||
//if(f.speak.checked) wc.speak(t.text,f.to.value)
|
||||
if(!so.got_more) {
|
||||
so.got_more=true
|
||||
trans(so.input,1,9)
|
||||
}
|
||||
}
|
||||
so.target.onclick=show_more
|
||||
|
||||
@@ -175,7 +180,7 @@ wc.translate=function() {
|
||||
}
|
||||
gftranslate.translate(text,f.from.value,wc.languages || f.to.value,i,count,step3)
|
||||
}
|
||||
function step2(text) { trans(text,0,10) }
|
||||
function step2(text) { trans(text,0,1) }
|
||||
function step2cnl(text) {
|
||||
function step3cnl(results) {
|
||||
var trans=results[0].translations
|
||||
|
||||
Reference in New Issue
Block a user