All Projects → lorniu → Go Translate

lorniu / Go Translate

Licence: mit
Improved Google Translate interface with asynchronous request and better user experience.

Projects that are alternatives of or similar to Go Translate

Ioslocalizationeditor
Simple macOS editor app to help you manage iOS and macOS app localizations by allowing you to edit all the translations side by side
Stars: ✭ 1,066 (+1422.86%)
Mutual labels:  translation
React Intl Hooks
React hooks for internationalization without the hassle ⚛️🌍
Stars: ✭ 64 (-8.57%)
Mutual labels:  translation
Sparsely Grouped Gan
Code for paper "Sparsely Grouped Multi-task Generative Adversarial Networks for Facial Attribute Manipulation"
Stars: ✭ 68 (-2.86%)
Mutual labels:  translation
Mue
Fast, open and free-to-use new tab page for modern browsers
Stars: ✭ 56 (-20%)
Mutual labels:  translation
Local Feature Android
Add online and offline text translation to Android apps
Stars: ✭ 60 (-14.29%)
Mutual labels:  translation
Localization Zh Cn Plugin
Chinese Localization for Jenkins
Stars: ✭ 65 (-7.14%)
Mutual labels:  translation
Eyevis
Android based Vocal Vision for Visually Impaired. Object Detection, Voice Assistance, Optical Character Reader, Read Aloud, Face Recognition, Landmark Recognition, Image Labelling etc.
Stars: ✭ 48 (-31.43%)
Mutual labels:  translation
Elm I18n
Localization for Elm apps as a pre-build phase with import and export between elm code and CSV/PO
Stars: ✭ 68 (-2.86%)
Mutual labels:  translation
Logisim
Logisim Italian Fork
Stars: ✭ 61 (-12.86%)
Mutual labels:  translation
The Road To Learn React Portuguese
The Road to Learn React - Tradução para o Português
Stars: ✭ 67 (-4.29%)
Mutual labels:  translation
Atom I18n
:atom: One Atom i18n Package for Any Locale 🌏 🌎 🌍
Stars: ✭ 56 (-20%)
Mutual labels:  translation
Scp zh
恒星共识协议中文翻译
Stars: ✭ 59 (-15.71%)
Mutual labels:  translation
Poedit
Translations editor for Mac, Windows and Unix
Stars: ✭ 1,140 (+1528.57%)
Mutual labels:  translation
Zing
Translation server for continuous localization.
Stars: ✭ 55 (-21.43%)
Mutual labels:  translation
Manpages Ko
리눅스 매뉴얼 페이지 일부 한글 번역
Stars: ✭ 68 (-2.86%)
Mutual labels:  translation
Gobyexample
🎁 Go By Example 한국어 버전
Stars: ✭ 50 (-28.57%)
Mutual labels:  translation
Google Translate Php
🌐 Free Google Translate API PHP Package. Translates totally free of charge.
Stars: ✭ 1,131 (+1515.71%)
Mutual labels:  translation
Alfred Dict.cc Workflow
Alfred 3/4 workflow to get translations from dict.cc
Stars: ✭ 69 (-1.43%)
Mutual labels:  translation
Android Translator
Stars: ✭ 69 (-1.43%)
Mutual labels:  translation
Gettext Go
🆎 GNU gettext for Go (Imported By Kubernetes)
Stars: ✭ 66 (-5.71%)
Mutual labels:  translation

License: MIT MELPA

Go-Translate

Improved Google Translate interface with asynchronous request and better user experience.

查看中文版文档

I have used translation frequently in recent days.

I tried Google Translate, it is cool, but something troubled me:

  • It's synchronous, every query will block anything, and the user experience is not good enough, especially when the network is poor
  • The result buffer is not formatted enough, and the operation is less user-friendly
  • The code is too long too old, make it hard to hack and extend new functions

So I wrote this plugin. It borrows some ideas and codes from Google Translate, and its main features are:

  • Completely asynchronous, without any blocking problems, so very smoothly
  • Optimize the display of translation results, the interface is more beautiful and natural
  • It is convenient for switch between different languages, and support many interactive operations
  • The code is clean, and easy to expand. New functions can be constructed very simply

Installation

With MELPA and package.el:

M-x package-install RET go-translate RET

(require 'go-translate)

Or manually download go-translate.el then put into /some-path, then add this to .emacs:

(add-to-list 'load-path "/some-path")
(require 'go-translate)

Configuration

First, config the local language and your default target language:

(setq go-translate-local-language "en")
(setq go-translate-target-language "fr")

If you have any other translation plans, then put them into go-translate-extra-directions:

(add-to-list go-translate-extra-directions (cons "ja" "ru"))  ; from japanese to russian
(add-to-list go-translate-extra-directions (cons "en" "fr"))  ; from english to french

;; or
(setq go-translate-extra-directions '(("ja" . "ru") ("en" . "fr")))

Other customizations you can look into custom-group - go-translate, eg:

(setq go-translate-buffer-follow-p t)       ; focus the result window
(setq go-translate-buffer-source-fold-p t)  ; fold the source text in the result window
(setq go-translate-buffer-window-config ..) ; config the result window as your wish

Usage

The core command is go-translate, and there are several extended commands such as go-translate-popup. You can bind keys for them. such as:

(global-set-key "\C-ct" 'go-translate)
(global-set-key "\C-cT" 'go-translate-popup)

go-translate will use a buffer to display translation results. In the result buffer, there are several shortcut keys:

  • g refresh q exit
  • x exchanges source language and target language and refresh the translation
  • M-n and M-p, switch to the next/prev available translation direction, and refresh
  • y to speak the current selection or word. You should have mplayer installed, or on Windows it will fallback to use powershell to do the tts job.

The go-translate will take the currently selected text or word-at-point as the default input. In the pop-up read-from-minibuffer interface, you can use C-l to clear the input, and fire the translation with Return or C-return. C-return will force the cursor follow the result window after translation. Also, you can use C-n and C-p to switch translation direcitons. These direcitons are those configured in go-translate-extra-directions above.

Other commands based on go-translate:

  • go-translate-popup is to display a short translation by popping up a posframe at the cursor.
  • go-translate-popup-current is to pop the result for the current selection or word, without prompt.
  • go-translate-kill-ring-save will not pop any user interface, but save the result into king-ring for later use.

Extending commands is easy and happy, go and have a try!

Extend

If you want to expand your own command, you only need to overwrite or let-binding the variables below:

  • go-translate-text-function the default translation content. If not specified, the text selected or at the cursor will be read
  • go-translate-inputs-function is used to process user input and select translation languages
  • go-translate-url-function is used to generate the request url
  • go-translate-prepare-function some preparatory work done before the request is send. For example, create a buffer and render something
  • go-translate-request-function asynchronously request to the server to get the translation content
  • go-translate-render-function render the returned result

You can take the source code of go-translate-popup for example.

In addition, a number of go-translate-result-* methods are also encapsulated to extract relevant content from the request result. They are useful when customizing the render function.

Miscellaneous

Nothing more to say now.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].