Skip to content

Paragraph-oriented Emacs minor mode for doing translation jobs.

License

Notifications You must be signed in to change notification settings

rayw000/translate-mode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

61 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MELPA MELPA Stable

Translate Mode

Paragraph-oriented minor mode for side-by-side document translation workflow. Your reference buffer will be scrolled automatically along with your translation buffer scrolling. Never get lost!

Screen Recording

screen record

Installation

You can install translate-mode from MELPA by

M-x package-install RET translate-mode RET

If you don't have ELPA package in your Emacs, clone this repository and load file.

git clone https://github.com/rayw000/translate-mode.git
(load-file "/path/to/translate-mode.el")
(require 'translate-mode)

Usage

Open the translation file you are working with, and run command

(translate-select-reference-buffer)

to select an existed reference buffer or

(translate-open-reference-file)

to open a reference file.

Customization

Interactive Functions

You can customize keybindings by setting translate-mode-map. Here are the default keybindings.

Keystroke Command Description
C-n translate-next-line Remapped from next-line
C-p translate-previous-line Remapped from previous-line
C-v translate-scroll-up Remapped from scroll-up-command
M-v translate-scroll-down Remapped from scroll-down-command
M-} translate-forward-paragraph Remapped from forward-paragraph
M-{ translate-backward-paragraph Remapped from backward-paragraph
C-< translate-beginning-of-buffer Remapped from beginning-of-buffer
C-> translate-end-of-buffer Remapped from end-of-buffer
RET translate-newline Remapped from newline
C-l translate-recenter-top-bottom Remapped from recenter-top-bottom, will also do translate-sync-cursor-to-current-paragraph

There are also interactive functions not bound. You can bind them to your favorite keystrokes.

Function Description
translate-toggle-highlight Toggle paragraph highlighting
translate-sync-cursor-to-current-paragraph Move the cursor in the reference buffer to the same n-th paragraph as the cursor in the translation buffer
translate-open-reference-file Prompt to open a file and set it as the reference buffer
translate-select-reference-buffer Prompt to select an existing buffer as the reference buffer

Variables

Name Default Value Description
translate-enable-highlight t Enable highlighting if non-nil.
translate-reference-buffer-read-only t Make reference buffer read-only if non-nil.

Face

(defface translate-paragraph-highlight-face
  '((t :background "grey15" :extend t))
  "Default face for highlighting the current paragraph in `translate-mode'."
  :group 'translate)

Cursor Moving Functions

You can customize the cursor moving functions to make translate-mode work better with many major modes. For example in markdown-mode, moving across paragraphs could be achieved by

(setq translate-forward-paragraph-function 'markdown-forward-paragraph)
(setq translate-backward-paragraph-function 'markdown-backward-paragraph)

Here are available cusor moving function variables.

Variable Default
translate-previous-line-function previous-line
translate-next-line-function next-line
translate-scroll-up-function scroll-up-command
translate-scroll-down-function scroll-down-command
translate-forward-paragraph-function forward-paragraph
translate-backward-paragraph-function backward-paragraph
translate-beginning-of-buffer-function beginning-of-buffer
translate-end-of-buffer-function end-of-buffer
translated-newline-function newline
translate-recenter-top-bottom-function recenter-top-bottom

About

Paragraph-oriented Emacs minor mode for doing translation jobs.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published