- lazy-lang-learn.el periodic display of new snippet to translate
Lazy timer based display of things to learn. Ability to recall and translate with presistance across sessions.
Defines a new minor-mode lazy-lang-learn-mode
which calls out to lazy-lang-learn--function
for a new snippet and displays it with lazy-lang-learn--display-function
. Stores it in lazy-lang-learn--history
which can be browsed and translated via lazy-lang-learn--translate-from-history
. Newly displayed snippets can be immediately translated using lazy-lang-learn-translate
.
A short video of lazy-lang-learn hosted on YouTube demonstrating it's usage. The first few seconds are blurred. No idea why but the rest is ok…
ffmpeg -video_size 1920x1080 -framerate 25 -f x11grab -i :0.0+0,0 output.mp4
This whole thing is based around using google-translate, a package that allows you to translate strings using Google Translate service directly from GNU Emacs. I have some customisations to this which can be found under my own emacs configuration in rgr/google.el
The default lazy-lang-learn--display-function
is set to 'alert
. See alert.
Debian comes with fortunes-de
which is the default snippet generator used by lazy-lang-learn--function
default function lazy-lang-learn--german-fortune
.
sudo apt install fortunes-de
C-u lazy-lang-learn-translate
will translate a random snippet from the history.
(use-package lazy-lang-learn
:straight (lazy-lang-learn :local-repo "~/development/projects/emacs/lazy-lang-learn" :type git :host github :repo "rileyrg/lazy-lang-learn" )
:bind
("C-c L" . lazy-lang-learn-mode)
("<f12>" . lazy-lang-learn-translate) ;; C-u f12 to translate a random history element.
("C-S-<f12>" . lazy-lang-learn-translate-random) ;; same as C-u lazy-lang-learn-translate
("S-<f12>" . lazy-lang-learn-translate-from-history))
-
lazy-lang-learn-new
display a new snippet
-
lazy-lang-learn-translate
translate last snippet displayed or translated. Prefix (C-u) to pick a random one from history.
-
lazy-lang-learn-translate-random
translates a random element from history - calls
lazy-lang-learn-translate
-
lazy-lang-learn-translate-from-history
interactively select from history and translate
Customisation group lazy-lang-learn
Idle time in seconds before it fetches a new snippet to display
Holds the name of a function to return snippets to store and later translate. Currently defaults to lazy-lang-learn--german-fortune
which simply calls out to the shell to get a unix fortune snippet…
(defun lazy-lang-learn--german-fortune()
"Return a german fortune string."
(shell-command-to-string "fortune de"))
Holds the name of a function to display new snippets to browse. Defaults to alert.
How many snippets to keep and save in lazy-lang-learn--history-file
The file used to store language snippets.
The minor mode indicator in the mode line.