Coder Social home page Coder Social logo

xylzq / translator-rs Goto Github PK

View Code? Open in Web Editor NEW

This project forked from rikonaka/translator-rs

0.0 0.0 0.0 6.55 MB

A Linux PDF paper real-time translation written with rust (of course not only PDF other can also be translated)

License: GNU General Public License v3.0

Shell 2.99% Rust 96.52% Batchfile 0.49%

translator-rs's Introduction

translator-rs

A simple real time translation of PDF papers written in rust for Linux users, with a translation API for Google. To avoid misunderstandings, rename the program from rust-translator to translator-rs.

Rust

中文帮助

Features

  • A simple selection can be translated to speed up reading papers.
  • Long sentence translation with automatic sentence break.
  • Support single word to view detailed similar translation.

example

Installation

Please install the xsel package before using it.

Installation on Debian and Ubuntu

sudo apt install xsel

Installation on Fedora

sudo dnf install xsel

Download binary file

Download and unpack the package from the release page, then place the binary file in /usr/bin (any PATH directory such /usr/local/bin anywhere you want).

Usage

Linux

If the binary file is already in the PATH directory, you can run the following command directly.

translator-rs

If not, use the terminal run with following command.

./translator-rs

Click on a word or a paragraph (tested on Ubuntu 22.04 Gnome with Wayland and X11 desktop environment and Kubuntu22.04 Plasma desktop).

  • O stands for original text
  • T stands for translation text
  • A stands for alternative text

Option Description

Switch translate API

Switch from the default google translate to deepl. The translation API for DeepL is now supported, but requires the user to have an auth key.

translator-rs -a deepl --auth-key xxxxxxxx:xx

or pro

translator-rs -a deeplpro --auth-key xxxxxxxx:xx

Proxy options

The Google Translate API has been blacklisted in China (2022-9-29), according to the latest firewall rules (GFW), so a proxy option has been added.

If there is an access timeout, please consider setting a proxy for the translation software, which currently supports the following proxies.

  • https proxy
  • socks5 proxy
translator-rs -p socks5://YOUR_PROXY_SERVER_IP:YOUR_PROXY_SERVER_PORT

Switching translation languages

The languages currently supported for translation include, default source language is English, and target language is Chinese.

  • English
  • Chinese
  • Japanese
  • French
  • German

If you need to translate into another language rather then default, use the following command to specify source language and target language.

translator-rs -s Engligh -t French

Faster sampling speed

If you think the translation speed is slow, you can use fast mode (power consumption may be higher than slow mode, the default is slow mode).

translator-rs -f

Clear screen mode

New clear screen mode. The default parameter in this mode clears the previous translations for each n translation.

translator-rs -c

If you want to clear the screen after three translations, you can use the following command.

translator-rs -c 3

Do not show original text

New option of not showing original text. If you want to not show the original text when translating, you can use the following options.

translator-rs --no-original

No automatic sentence break

Added no automatic sentence break. If you do not want to break the sentence automatically, you can use the option.

translator-rs --disable-auto-break

Others

Added support for some applications on Linux that do not automatically get selected text. Some Linux applications (like Zotero) have the function of intercepting the text selection system call, please select the text then copying it via ctrl-c.

translator-rs --linux-use-clipboard

Why don't you support gui or tui?

Do not want to waste time in this area, can meet the use of the line 😘, in fact, there is no need for this.

You are welcome to submit any code to improve the program.

translator-rs's People

Contributors

rikonaka avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.