From: Daniel Hodgin Date: Fri, 25 Jun 2010 16:31:00 +0000 (-0400) Subject: Merge branch 'translate' of git://github.com/ScottDowne/popcorn-js X-Git-Tag: v0.1~77 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=faaa9535d845b120c291bf0b16e3bd4675dd813f;p=popcorn-js.git Merge branch 'translate' of git://github.com/ScottDowne/popcorn-js --- faaa9535d845b120c291bf0b16e3bd4675dd813f diff --cc popcorn.js index 82be994,ba1c1b2..6b998ee --- a/popcorn.js +++ b/popcorn.js @@@ -133,14 -104,15 +133,18 @@@ }; VideoCommand.count = 0; - // Child commands. Uses onIn() and onOut() to do time based operations - var SubtitleCommand = function(name, params, text) { - VideoCommand.call(this, name, params, text); + //////////////////////////////////////////////////////////////////////////// + // Subtitle Command + //////////////////////////////////////////////////////////////////////////// + + var SubtitleCommand = function(name, params, text, videoManager) { + VideoCommand.call(this, name, params, text, videoManager); this.onIn = function() { - document.getElementById("sub").innerHTML = this.text; + var i = document.getElementById("language").selectedIndex; + google.language.translate(this.text, '', document.getElementById("language").options[i].getAttribute("val"), function(result) { + document.getElementById("sub").innerHTML = result.translation; + }); + }; this.onOut = function() { document.getElementById("sub").innerHTML = "";