Skip to content

Google language translator plugin for Neovim

License

Notifications You must be signed in to change notification settings

utahta/trans.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

66 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

trans.nvim

trans.nvim is a plugin for Neovim to translate text with Google Translator.

message

trans_nvim_message

preview

trans_nvim_preview

floating window

trans_nvim_floating_window

Required

You must first set up authentication by creating a API Key or service account of GCP.

Then you need to install the Go of version 1.11 or more.

Using API Key

The API Key documentation can be found here.

Please set the environment variable TRANS_API_KEY to the API Key.

Or Using Service Account

The service account documentation can be found here.

Please set the environment variable GOOGLE_APPLICATION_CREDENTIALS to the file path of the JSON file that contains your service account key.

Note

You need a little bit of money to use google translate API.
e.g. it costs $0.06 for 2889 characters.

Installation

For vim-plug

Plug 'utahta/trans.nvim', {'do': 'make'}

Settings

let g:trans_lang_locale = 'ja'
let g:trans_lang_output = 'preview'

To use floating windows

Floating windows are supported in neovim >= 0.4.0.

let g:trans_lang_output = 'float'

A Floating window is automatically hide when cursor is moved.