kshitij10496 / lexico

CLI to familiarize you with those elusive words
MIT License
22 stars 12 forks source link

Add support for word translations #11

Closed kshitij10496 closed 6 years ago

kshitij10496 commented 6 years ago

Using Google Translate API, we can try to add word translation feature to the application. If someone can share the results of a Proof-Of-Concept(POC), we can discuss further concrete implementation details.

priyanshsaxena commented 6 years ago

Should the translation be two-way ? That is to say, both from some language to English and vice-versa ?

kshitij10496 commented 6 years ago

Ideally, the user should be able to translate both ways. But for starters, let's keep it simple and try to add one-way translation from English to the user-desired language.

priyanshsaxena commented 6 years ago

@kshitij10496 I am planning to add a new command like the one below:

lexico translate <word> <src> <dest>

If only three args are given, 'src' will default to English. 'dest' language can be given in both two-character format ('es' for Spanish) or as complete word ('Spanish' for Spanish, ignoring cases). This requires the use of googletrans package (added to setup.py), since Google Cloud Translate API is not free.

Does this work ?

kshitij10496 commented 6 years ago

Rather than adding a separate command, let's integrate it in the pager view itself(by modifying the Word object). We will create a framework for commands later.

priyanshsaxena commented 6 years ago

What should be the trigger-event for the translation to be done ? I did this the way I had written about earlier and it saves the English word if it's not already present.

kshitij10496 commented 6 years ago

Whenever anyone searches a word: $lexico add <some_word>, the result page should contain a translation along with currently present details.

priyanshsaxena commented 6 years ago

For now, I can add some default translations for that word. But what should the user do if he wants to do a custom translation that is not present by default ?

priyanshsaxena commented 6 years ago

@kshitij10496 please review PR #12 for this issue.

kshitij10496 commented 6 years ago

Issue closed by #12

@priyanshsaxena Adding a sentence referencing the issue being resolved by a commit is considered a good practice. Also, GitHub automatically closes the related issue when the commit is merged. Refer: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html

priyanshsaxena commented 6 years ago

Thanks for the info. I forgot to do that. Thanks for doing this as well. I'll keep this in mind.