Vim script CoffeeScript JavaScript Lua
Pull request Compare This branch is 16 commits ahead, 1 commit behind vim-scripts:master.
Latest commit 38c3efe Jan 27, 2014 @maksimr Merge pull request #1 from hexode/output_bugfix
Fix bug with translation one word (node)
Permalink
Failed to load latest commit information.
plugin fixed sentence translation Jan 27, 2014
.gitignore added support nodejs Nov 1, 2011
README.markdown added implementation on v8cgi Dec 11, 2011

README.markdown

translator.vim

This script allows you to translate text using the google online translator. You can translate as single words and whole blocks using visual-mode.

Use :Translate Hello World to translate words or sentences Note: With a large number of text program can take some time

Installation

For version 1.3 you may choose driver for translate, now available ruby ,node.js, v8cgi, lua

  • Ruby

    • install ruby
    • install vim with supporting ruby
  • Node.js

    • install node.js
  • V8cgi

  • Lua

    • install lua
    • install vim with supporting lua
    • install socket.http for lua (liblua5.1-socket-dev for ubuntu)

If you use version 1.2(that do not support nodejs) you must install ruby and install gem json.

place files in plugin directory or under bundle bundle/vim-translator

Configuration

The whole setting is made through a variable g:goog_user_conf in your vimrc file.


user configuration for ruby

  ".vimrc
  g:goog_user_conf = {
    'langpair': 'en|ru', "language code iso 639-1
    'v_key': 'T' "? define key in visual-mode (optional)
  }

user configuration for node.js

  ".vimrc
  g:goog_user_conf = {
    'langpair': 'en|ru', "language code iso 639-1
    'cmd': 'node',
    'v_key': 'T' "? define key in visual-mode (optional)
  }

user configuration for lua

  ".vimrc
  g:goog_user_conf = {
    'langpair': 'en|ru', "language code iso 639-1
    'cmd': 'lua',
    'v_key': 'T' "? define key in visual-mode (optional)
  }

user configuration with available parameters

  ".vimrc
  g:goog_user_conf = {
    'langpair': 'en|ru', "language code iso 639-1
    'cmd' : 'node',
    'v_key': 'T', "? define key in visual-mode (optional)
    'charset' : 'koi8-r' "? if need change encoding (use iconv) (optional)
  }

user configuration for v8cgi

  ".vimrc
  g:goog_user_conf = {
    'langpair': 'en|ru',
    'cmd': 'v8cgi'
  }

(version: 1.3.2)