WeeChat DevCenter

Script translate.py

A new script translate.py is now available. It can translate words with a command or in input (whole input or last word).

Base and target languages can be customized and given as argument of command, or at beginning of input if you're using a key calling command.

Example of keys you can bind to use script:

  • translate input with alt-t + alt-t (using default from_to): /key bind meta-tmeta-t /translate
  • translate input with alt-t + alt-r (reverse of from_to): /key bind meta-tmeta-r /translate !
  • translate last word in input with alt-t + alt-w (using default from_to): /key bind meta-tmeta-w /translate +
  • restore input as it was before last translation with alt-t + alt-u: /key bind meta-tmeta-u /translate <

Other examples:

  • reverse languages (english to french by default): /translate ! this is a test
  • english to italian: /translate en_it I want this string in italian

Recommended alias:

/alias tr /translate

You can get more help with /help translate.