#require 'rubygems'
require "rtranslate"

Shoes.app :width => 600, :title => "Translatr", :height => 250 do
  background rgb(250, 250, 108)	

	@eBox = edit_box :margin => 20, :width => -1
		
	flow :margin => 10 do
	  @myLang = list_box  :margin_left => 10, :items => ["To Spanish", "To English"], :choose => "To Spanish"
	  @mButton = button "Translate", :margin_left => 10, :width => 160 do
	    if @myLang.text == "To English" 
	      @newText = Translate.t(@eBox.text, Language::SPANISH, Language::ENGLISH)
	    else
	      @newText = Translate.t(@eBox.text, Language::ENGLISH, Language::SPANISH)
	    end
      @myText.replace "You entered:\n" + @eBox.text
      @eBox.text = @newText  
    end
    button "Instructions", :margin_left => 10, :width => 160 do
      window :width => 470, :height => 120 do
        para "Enter the words you want to translate into the box at the top, then select the language to translate to.  Then press the 'Translate' key.  The text you entered will be replaced with the translated text.  You can copy this text to the clipboard for use in other applications."
      end
    end
  end
  stack :margin => 10 do
		@myText = para "Waiting..."
	end
end