Git Product home page Git Product logo

got's Introduction

got

GO GHCR AUR Go Report Card

Table of Contents

Demo - Usage - Features - Testing

go-translation (shortly got), a simple translator and text-to-speech app built on top of simplytranslate and lingvatranslate APIs. The interface is made with the awesome bubbletea tui library.

⚠️ simplytranslate is currently down. I still kept it as a valid backend in the hope of a future comeback, by default got uses now lingvatranslate

Screenshots here

Disclaimer: this is my absolute first project in golang, so bugs and clunky code are expected…

The project is still a work-in-progress, breaking changes and heavy refactoring may happen

Demo

Kooha-05-01-2022-18-10-58.mp4

Usage

  • Install got:

With the go tool:

go install github.com/fedeztk/got/cmd/got@latest

Or from source:

# clone the repo
git clone https://github.com/fedeztk/got.git
# install manually 
make install

In both cases make sure that you have the go bin directory in your path:

export PATH="$HOME/go/bin:$PATH"

If you are an Arch user there is also an AUR package available:

paru -S go-translation-git
  • Copy the sample config file under ~/.config/got/ as config.yml or let the program generate one for you at the first run
  • Run it interactively:
got            # use last used engine, default is google
got -e reverso # change engine to reverso
  • Or in oneshot mode:
got -o -s en -t it "Hello World"          # use default (google)
got -o -e libre -s en -t it "Hello World" # use libre-translate

For more information check the help (got -h)

Features

  • Interact with various translation engines easily via the terminal, no need to open a browser!
  • Clean interface with 3 tabs, switch between them with tab/shift-tab:
    • text input: input the sentence you want to translate, press enter to translate image
    • language selection: choose between 108 languages, select source language with s, target with t and i to invert the target with the source. Press ? to show the full help menu image Full help: image
    • translation: pager that shows the result of translation. Copy translation with y, listen the translation with p image
  • engines (only available with simplytranslate backend): choose between google, libre-translate, reverso and iciba (deepl is not working yet)
  • quit anytime with esc or ctrl-c
  • automatically remembers the last languages used

Testing

Development is done through docker, build the container with:

make docker-build

Check that the build went fine:

docker images | grep got

Test it with:

make docker-run

Pre-built Docker image available here

got's People

Contributors

fedeztk avatar

Stargazers

Thiiti Baipad avatar  avatar  avatar Luis Tenorio avatar  avatar Pedro Torreão avatar Conor Fleming avatar Khoa Pham avatar Giorgos Kal avatar Guillaume Landreau avatar kurple avatar  avatar Ian Effendi avatar  avatar Ahmad Haris avatar  avatar Willie Möller avatar Rafael Bodill avatar ik5 avatar Alexander I.Grafov avatar houboxue avatar Jo avatar Shafreeck avatar prospero78 avatar Jonathan Zollinger avatar Marcus Xavier avatar Kovács Bálint Hunor avatar Hunter Hartline avatar  avatar Aryabhatta Dey avatar  avatar  avatar alaska avatar Nikolai Skvortsov avatar Przemysław Pająk avatar Tom Tobias avatar Grimorian avatar  avatar Yosef Bernal avatar Som Nek avatar  avatar Rayat Rahman avatar Daniel Yentin avatar Raymond Rolston avatar  avatar estebiu avatar Muluneh Derese avatar Alexandre Possebom avatar Rafał Malinowski avatar  avatar Libon avatar Changseo Jang avatar Ivan Milovanov avatar Ivonaldo Amaral avatar 爱可可-爱生活 avatar Shadab Zafar avatar Tobias Alrøe avatar Herby Gillot avatar Javier Tia avatar Edinson E. Padrón Urdaneta avatar Will Barnard avatar Radja Fajrul Ghufron avatar Daniel Dugovic avatar Jeremy Winter avatar Tagirov Alexander avatar Lord Alveric avatar Marcel Schilling avatar Fernando Becerra Méndez avatar  avatar  avatar The 0Day avatar  avatar  avatar Animesh Sahu avatar Martin Rosenberg avatar ringsaturn avatar yetone avatar Sidhanth Rathod avatar Sovea avatar Myroslav Rys avatar Keboland avatar Paul avatar Gowon Patterson avatar Alysonhower Veras Vieira avatar Bevan Stanely avatar Lewis Dixon avatar Matias Pujado avatar Joel avatar dexit141 avatar  avatar Antonio Muñoz avatar Panos Koutsoumanis avatar  avatar Jim Carroll avatar Sergio Galvan avatar  avatar  avatar helium avatar Sangjee Dondrub avatar  avatar

Watchers

 avatar

got's Issues

[Error] Simple word with no extra information is not translated

It looks like when a simple (with no extra information being provided by the engine) word is used as a input, the translation does not occurred.

This is the only example I've found so far:

❯ got -o -f es -t en "hola"
Translated text: hola 
  • Engine: Google
  • Version: 2a5b336 (got -v don't show a thing. since I just installed I could assume I have the last current commit)

Add support in termux

I need to add support in termux but i got complie error

# golang.org/x/mobile/app
android.c:170:52: error: incompatible pointer to integer conversion passing 'ANativeWindow *' (aka 'struct ANativeWindow *') to parameter of type 'EGLNativeWindowType' (aka 'unsigned long') [-Wint-conversion]
../usr/include/EGL/egl.h:136:109: note: passing argument to parameter 'win' here

[Error] Part of speech: null

When a word has no "part of a speech" information, Part of speech: null is shown. For example:

❯ got -o -f es -t en "ah"
Translated text: ah

Part of speech: null

Definition:
- Indica que el que habla se ha dado cuenta de algo o lo ha comprendido.
Use in sentence:
- ¡ah!, entonces tú no estabas

Definition:
- Indica admiración, sorpresa o pena.
Use in sentence:
- ¡ah!, ¿sí?

Definition:
- Indica satisfacción o alegría.
Use in sentence:
- ¡ah, qué bien lo pasábamos entonces!

Definition:
- Se utiliza para advertir de algo o para decir algo que se había olvidado
Use in sentence:
- ah, y no se lo digas a nadie que todavía no es seguro


Part of speech: interjection

- Ha!: ¡Ah!
- Ahoy!: ¡Ah!
  • Engine: Google
  • Version: 2a5b336 (got -v don't show a thing. since I just installed I could assume I have the last current commit)

Please make colors configurable

Hi,

I like your tool -- it is very hand in "simple" environments!

I only have some troubles with the (pre)selected colors:
grafik

Please make them configurable in .config/got/config.yml

[Error] invalid character '<' when introducing a one-word-string input

Here is a simple example

❯ got -o -f es -t en "adiós"
invalid character '<' looking for beginning of value

Replacing the acute ó by normal/ascii o seen to work

❯ got -o -f es -t en "adios"                                                                           ─╯
Translated text: adios

Part of speech: noun

- adieu: adiós, despedida

Another example

❯ got -o -f es -t en ""
invalid character '<' looking for beginning of value

It works fine for a sentence

❯ got -o -f es -t en "¿Qué haces?" 
Translated text: What are you doing?

Part of speech: phrase

- What do you do?: ¿Qué haces?

Update:
I found just by chance another input that produces the same error but it does not have acute vowels:

❯ got -o -f es -t en "meta"
invalid character '<' looking for beginning of value
  • Engine: Google
  • Version: 2a5b336 (got -v don't show a thing. since I just installed I could assume I have the last current commit)
find . -iname '*got@v*'
./mod/cache/download/sumdb/sum.golang.org/lookup/github.com/fedeztk/[email protected]
./mod/github.com/fedeztk/[email protected]

Strip decorations for the oneshot mode?

When using got in the oneshot mode with -o, it would made sense to disable coloring and indenting the output as well as the Translated text: prefix in case the result will get passed to some other program, script, filter or pager.

May be adding some "stricter" oneshot mode is worth considering, like with -O, for instance? :)

Shortcut to reverse target/source language + Multi language support

The same way we have the "s" and the "t" shortcut to choose the source and the target's language, It will be awesome if we could switch this two languages with a shortcut, let's say "r". So now if we choose english as the source ant french as the target and press "r", now we'll have french as the source and english as the target languages.

My second improvement would be to add support to 2 or more languages: it'd be awesome if we could add 2 or more languages as the targets, to have multiples translations at the same time. It would be super useful if we are studying a new language when you're already fluent in other 2 (or more) languages. It's a feature that I always wanted on google translate but.. well.. never got.

Navigation is confusing and cumbersome

Hey there, love this tool!

It's super useful, unfortunately the navigation is extremely cumbersome and confusing. From what I see, one needs to press Tab to switch to "Language selection" first (which isn't obvious, because it doesn't say how to change tabs anywhere), then use / to search for a language (fyi, typing es to find Spanish won't work, even though that's the short code for it), then type s to select it as source, then type / again, type eng, and then type t to select it as target, then press Shift+Tab (again, not obvious) to switch back to text input and only then actually type the text.

I believe it would make more sense to get rid of the second tab and have e.g. C-f ("from") and C-t ("to") as global key bindings, which would allow for selecting the source/target language from a "popup"/modal using basically the same idea as right now (search with /).

Also, it would be nice if the translation tab would display the translated text underneath "Translated text:" (-> add \n\n) and support a shortcut like yy to copy the translation to the clipboard.

Thank you very much for your effort of building this!

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.