sponsor Vim development Vim logo Vim Book Ad

sadic.tgz : Japanese to  English and English to Japanese translator

 script karma  Rating 24/8, Downloaded by 566  Comments, bugs, improvements  Vim wiki

created by
saber zrelli
 
script type
utility
 
description
This is a handy utility to translate text from Japanese to English and vice versa.
It uses the excite.co.jp services to translate the text then displays the result in
the standard output.

sadict was created to be integrated with vim and mutt ,
If you add the following lines into your ~/.vimrc

vmap j :w! /tmp/.vim.msg.en<cr>:!sadic -j  < /tmp/.vim.msg.en<cr>
vmap ,j :w! /tmp/.vim.msg.en<cr><esc>`>o<cr><esc>:r !sadic -j < /tmp/.vim.msg.en<cr>
vmap e :w! /tmp/.vim.msg.jp<cr>:!sadic < /tmp/.msg.jp<cr>
vmap ,e :w! /tmp/.vim.msg.jp<cr><esc>`>o<cr><esc>:r !sadic < /tmp/.vim.msg.jp<cr>

Then you can visually select a text region (by pressing Shift-V then
moving the cursor), then when you press "j" , the text will be translated
from English to Japanese.

",j" translates the text from english to Japanese then appends the result (japanese text)
right after the visually selection region.

The "e" and ",e" mappings do the same thing except that they translate text from
Japanese to English.

For Mutt , you can add the following into your .muttrc
macro pager   j          "v\n| nkf -e | sadic -j | less \nq<left>"
macro pager   e         "v\n| nkf -e | sadic  | less \nq<left>"

Then , while viewing your e-mails , you can press "j" to translate from English
to Japanese. and "e" to translate from Japanese to English.
 
install details
0- Download and extract sadic.tgz somewhere

1- Edit the file "install" and change the variable "prefix".  The default
installation path is your home directory $HOME/bin . The location "prefix"
must be in your shell $PATH.

2- Run the installation script $./install

3- Add the following into your vimrc  :

vmap j :w! /tmp/.vim.msg.en<cr>:!sadic -j  < /tmp/.vim.msg.en<cr>
vmap ,j :w! /tmp/.vim.msg.en<cr><esc>`>o<cr><esc>:r !sadic -j < /tmp/.vim.msg.en<cr>
vmap e :w! /tmp/.vim.msg.jp<cr>:!sadic < /tmp/.msg.jp<cr>
vmap ,e :w! /tmp/.vim.msg.jp<cr><esc>`>o<cr><esc>:r !sadic < /tmp/.vim.msg.jp<cr>

4- Add the following in your .muttrc :

macro pager   j          "v\n| nkf -e | sadic -j | less \nq<left>"
macro pager   e         "v\n| nkf -e | sadic  | less \nq<left>"

 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
sadic.tgz 1.0 2005-05-20 6.0 saber zrelli Initial Upload
ip used for rating: 3.133.86.172

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
Vim at Github