summaryrefslogtreecommitdiff
path: root/src/www/translator/translator.js
diff options
context:
space:
mode:
authorhallgren <hallgren@chalmers.se>2013-04-12 18:29:15 +0000
committerhallgren <hallgren@chalmers.se>2013-04-12 18:29:15 +0000
commitd35790e656fe70f0fa258fb8fb84aa65f9887616 (patch)
treec3cf3663e450d3a7163cf7aaabcae8fe2c9b081f /src/www/translator/translator.js
parent1d0f9372f4c74075a98bc824568ceedb80f6cd78 (diff)
GF cloud: work on syntax editor integration
+ The syntax editor is now accessible from the Simple Translaton Tool. + The minibar now automatically provides access to the syntax editor (provided the necessary JavaScript files and style sheets have been loaded). + Preparations for making the syntax editor accessible from the grammar editor.
Diffstat (limited to 'src/www/translator/translator.js')
-rw-r--r--src/www/translator/translator.js15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/www/translator/translator.js b/src/www/translator/translator.js
index 38b4d01da..7d766258d 100644
--- a/src/www/translator/translator.js
+++ b/src/www/translator/translator.js
@@ -305,11 +305,7 @@ function uses_gf(doc,segment) {
var m= segment.options.method || doc.options.method
var d=segment.use_default
if(d || d==null) m=doc.options.method
- switch(m) {
- case "Manual": return null
- case "Apertium": return null
- default: return m
- }
+ return /\.pgf$/.test(m) ? m : null
}
Translator.prototype.add_apertium=function() {
@@ -769,7 +765,8 @@ Translator.prototype.edit_source=function(source,i) {
var pgf_server=t.servers[grammarname]
function cont2(source) {
function ok() {
- unlextext(gf_unlex(minibar.input.current.input),change)
+ function cont(input) { unlextext(input,change) }
+ minibar.get_current_input(cont)
t.hide_filebox()
}
function cancel() {
@@ -789,9 +786,11 @@ Translator.prototype.edit_source=function(source,i) {
initial:{from:gfrom,
startcat:grammar_info.startcat,
input:source.split(" ")},
- initial_toLangs: [gto]
+ initial_toLangs: [gfrom,gto]
}
- replaceChildren(t.filebox,empty_id("div","minibar"))
+ clear(t.filebox)
+ appendChildren(t.filebox,[empty_id("div","minibar"),
+ empty_id("div","syntax_editor")])
var minibar=new Minibar(pgf_server,minibar_options)
appendChildren(t.filebox,[button("OK",ok),
button("Cancel",cancel)])