https://github.com/rangzen/t2
Traduction Translation aka T2 can help you improve when writing in a foreign language.
https://github.com/rangzen/t2
translation
Last synced: 5 months ago
JSON representation
Traduction Translation aka T2 can help you improve when writing in a foreign language.
- Host: GitHub
- URL: https://github.com/rangzen/t2
- Owner: rangzen
- License: gpl-3.0
- Created: 2021-09-22T12:07:59.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2022-12-24T04:13:47.000Z (over 3 years ago)
- Last Synced: 2026-01-13T03:30:01.508Z (6 months ago)
- Topics: translation
- Language: Go
- Homepage:
- Size: 114 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Traduction Translation aka T2
Check how your test resists to double translation.
I’m French, so when I write in english, I sometimes use double translation to check how the translated english "sounds".
On a translation software, I write directly in English, I translate into French and translate back again into English.
The name "Traduction Translation" comes from there, "traduction" being "translation" in French.
As a developer, I wanted to try to automate this thing and share it with you.
Just copy some text, then run `t2 clipboard`, and "voilà".
I hope it will help you.
Yes, documentation was checked with t2 :)
## Examples
In a terminal, the diff version will appear in color:

Don't forget the `--diff-only` or `-d` flag if you want to display only this part.
### Translate from CLI
```shell
$ t2 "I want speak english."
Using config file: /home/user/.t2.yaml
# Original text
I want speak english.
# Pivot text
Je veux parler anglais.
# Double translated text
I want to speak English.
# Diff version
I want to speak eEnglish.
```
### Translate from the clipboard
Don't bother with copy/paste operations, quoting text, etc. Just copy what you want to check and then `t2 clipboard`.
You can add the `-c` flag to return the result to the clipboard.
```shell
$ t2 clipboard
Using config file: /home/user/.t2.yaml
# Original text
Some text this was in clipboard.
# Pivot text
Certains textes étaient dans le presse-papiers.
# Double translated text
Some texts were in the clipboard.
# Diff version
Some text this wasere in the clipboard.
```
### Usage
```shell
$ t2 usage
Using config file: /home/user/.t2.yaml
Usage: 12477/500000
```
## Installation
```shell
go install github.com/rangzen/t2@latest
```
## Translation services
#### Configuration
* Create a `.t2.yaml` file configuration with:
```yaml
TranslationServices:
DeepL:
Endpoint: https://api-free.deepl.com/v2/translate
ApiKey: redacted-0123-0123-0123-redacted:fx
Google:
Endpoint: https://translation.googleapis.com/language/translate/v2
ApiKey: redactedredactedredacted
```
See the `t2-example.yaml` file for an example.
### DeepL
The actual default service for translation is [DeepL](https://deepl.com).
You’ll need a Pro free account because the free account is almost always out of limits.
I don’t have a Pro paid account, but I think that you just have to change the Endpoint configuration.
### Google Cloud Translation
For using [Google Cloud Translation](https://cloud.google.com/translate/), you need:
* a Google Cloud account,
* a Paid account,
* an API key without restriction.
"The `usage` command doesn't work with Google!"
I know. If you know the API endpoint for usage, please let me know.