From ca58233bf7244e4f6381bff6e8c5ccc2b81a1c51 Mon Sep 17 00:00:00 2001 From: hallgren Date: Sun, 30 Sep 2012 15:35:25 +0000 Subject: PGF service & minibar: put a limit on the number of parse trees + In the PGF web service API, the commands parse, translate and translategroup now accept a limit parameter. It limits the number of parse trees returned. If no limit is given, the behaviour is backwards compatible, i.e. no limit is applied. + In minibar, the limit is now set to 25 by default. This change is based on a suggestion by Kaarel Kaljurand. --- src/www/minibar/minibar-api.html | 8 +++++--- src/www/minibar/minibar_translations.js | 4 +++- 2 files changed, 8 insertions(+), 4 deletions(-) (limited to 'src/www') diff --git a/src/www/minibar/minibar-api.html b/src/www/minibar/minibar-api.html index a30fa2e5d..d65d92652 100644 --- a/src/www/minibar/minibar-api.html +++ b/src/www/minibar/minibar-api.html @@ -70,12 +70,14 @@ For an example, see minibar.html. can be set to override various default options:
OptionDefaultDescription -
show_abstractfalseSee Translations, +
show_abstractfalseSee Translations, not used directly by Minibar
show_treesfalse
tree_img_format"png"
show_grouped_translationstrue
show_bracketsfalse +
translate_limit25 +
delete_button_text"⌫"See Input, not used directly by Minibar
default_source_languagenull @@ -212,7 +214,7 @@ HTML file, you would normally include at least the following:
show_grouped_translationstruein case there are multiple translations, group them by concrete language
show_bracketsfalseshow bracketed string -
+ translate_limit25maximum number of parse trees to retrieve @@ -247,7 +249,7 @@ the user interface:
-HTML Last modified: Mon Sep 17 17:52:22 CEST 2012 +HTML Last modified: Sun Sep 30 17:33:51 CEST 2012
diff --git a/src/www/minibar/minibar_translations.js b/src/www/minibar/minibar_translations.js index 167417844..43b959d3e 100644 --- a/src/www/minibar/minibar_translations.js +++ b/src/www/minibar/minibar_translations.js @@ -14,7 +14,8 @@ function Translations(server,opts) { tree_img_format: "png", // format for trees & alignment images, // can be "gif", "png" or "svg" show_grouped_translations: true, - show_brackets: false // show bracketed string + show_brackets: false, // show bracketed string + translate_limit: 25 // maximum number of parse trees to retrieve } // Apply supplied options @@ -53,6 +54,7 @@ Translations.prototype.get_translations=function() { with(this) { var c=current; var args={from:c.from,input:gf_unlex(c.input),cat:startcat} + if(options.translate_limit) args.limit=options.translate_limit if(options.show_grouped_translations) server.translategroup(args,bind(show_groupedtranslations,this)); else -- cgit v1.2.3