Open pwyq opened 6 years ago
Glossary would be a nice thing to have.
Appending words to a local text file can be trivially implemented. But is there anything else you would like to achieve with trans
, like showing a warning while looking up a previously searched word or quizzing the user about a random word? Or just having an incremental text file is sufficient?
Hi, :) Showing a warning is a nice idea. To build on top of that, can we count the number of times of each searched word, and then sort all words based on search frequency?
I would like the word plus its definition saved to a file, then I can trivially make flashcards out of that. I don't think trans
itself should be a flashcard app.
Upvoting this enhancement, also for the purpose of making flashcards.
A trivial way to save to a text file:
(I put it in my ~/.bash_profile
, one may also put in ~/.bashrc
)
function tran() {
vocab_path='/absolute/path/to/your/file'
echo "================================" >> $vocab_path
# :zh = translate to Chinese; sed removes special characters
trans :zh $1 | sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[mGK]//g" | tee -a $vocab_path
echo -e "\n" >> $vocab_path
}
Then you can just call $ tran new-word
to see the translation and also saves to a file.
This is a very cool and useful tool!!
I have been using this tool for a while, and from time to time, I wish there is a mechanism that can automatically detect a newly-searched word and append it to a local text file. Such that, we would have a personalized glossary book after a period of time (which I believe it would be a great feature to help users learning new words).
I am wondering if this feature is already in future development plan of the
translate-shell
? Or is it possible to implement? If this feature is feasible, I would like to contribute :).