deepl_translator
is a simple command-line tool that uses the DeepL API (free version) to translate text between English and Japanese. This tool takes text from standard input and outputs the translation to standard output.
- Supports translation from English to Japanese and vice versa
- Easy to use from the command line
- Simple API key configuration through a
.env
file
- Python 3.x
- pip (Python's package manager)
Use the following command to install deepl_translator
:
pip install git+https://yourrepository.com/deepl_translator.git
Note: Replace the above URL with the URL of the Git repository hosting this package.
Before using deepl_translator
, you need to obtain a free API key from DeepL API and configure it in a .env
file as follows:
- Create a free account on DeepL API and obtain an API key here.
- Create a
.env
file in the root directory of the project. - Add the following content to the
.env
file, replacingYOUR_API_KEY
with your actual API key:
DEEPL_API_KEY=YOUR_API_KEY
Use deepl_translator
from the command line to translate a text file:
cat input.txt | deepl -t [target_language] > output.txt
Here, [target_language]
specifies the target language for translation. The options are as follows:
j
orjapanese
: Translate to Japanesee
orenglish
: Translate to English
For example, to translate an English text file to Japanese:
cat input.txt | deepl -t j > output.txt
This project is published under the MIT License.
If you would like to contribute, please send a pull request or report an issue. We appreciate all contributions!