Wide coverage demo web app improvements

+ Adapt language selection menus to the languages supported by the grammar.
+ Add translation quality colors to the links to alternative translations.
+ Also added more country codes in langcode.js (needed for speech synthesis
  voice selection).
This commit is contained in:
hallgren
2014-03-28 14:56:56 +00:00
parent 035d367b1f
commit 98d9946ac4
3 changed files with 59 additions and 17 deletions

View File

@@ -25,9 +25,8 @@ gftranslate.translate=function(source,from,to,start,limit,cont) {
else cont([{error:"sentence too long"}])
}
// Get functions to test which source and target langauges are supported
gftranslate.get_support=function(cont) {
function support(code) { return gftranslate.targets[code] }
// Get list of supported languages
gftranslate.get_languages=function(cont) {
function init2(grammar_info) {
var ls=grammar_info.languages
gftranslate.grammar=grammar_info.name
@@ -35,9 +34,19 @@ gftranslate.get_support=function(cont) {
for(var i=0;i<ls.length;i++)
if(ls[i].name.substr(0,n)==pre) langs.push(ls[i].name.substr(n))
gftranslate.targetlist=langs
cont(langs)
}
if(gftranslate.targetlist) cont(gftranslate.targetlist)
else gftranslate.call("?command=c-grammar",init2)
}
// Get functions to test which source and target langauges are supported
gftranslate.get_support=function(cont) {
function support(code) { return gftranslate.targets[code] }
function init2(langs) {
gftranslate.targets=toSet(langs)
cont(support,support)
}
if(gftranslate.targets) cont(support,support)
else gftranslate.call("?command=c-grammar",init2)
else gftranslate.get_languages(init2)
}