π“Ÿ host1.bitchan.one

𓀐 @aQ6+a?fA

⏱ 1w seenβ›“ 0πŸ‘ 0β§– 1

filter [-]

languages:onother

I made something like this, but it relies on a Common Lisp library to do the Japanese to English translation. Ichiran is the Common Lisp library. https://github.com/tshatrov/ichiran On the Emacs side, the requirements are: - You have to have sly or slime running. - org-babel-lisp-eval-fn must be setup to either #'sly-eval or #'slime-eval depending on which CL REPL you're using. - In that CL REPL, you have to (ql:quickload :ichiran) . If you've done all that, you can use this Elisp function to do lookups. (defun ichiran-romanize (phrase) "Romanize a Japanese PHRASE using ichiran. Results are displayed in an *ichiran* `org-mode' buffer. For this to work: 1. `sly' or `slime' must already be running. 2. `org-babel-lisp-eval-fn' must be set appropriately. 3. The ichiran CL library must be loaded into that sly (or slime) instance." (interactive "MPhrase: ") (unless (stringp phrase) (user-error "Phrase must be a string.")) (let* ((result (funcall org-babel-lisp-eval-fn `(cl:multiple-value-list (ichiran:romanize ,phrase :with-info t)))) (romanized-text (car result)) (romanized-info (cadr result)) (buffer (get-buffer-create "*ichiran*")) (window (or (get-buffer-window buffer) (switch-to-buffer-other-window buffer)))) (with-current-buffer buffer (when view-mode (view-mode -1)) (delete-region (point-min) (point-max)) (unless (equal major-mode 'org-mode) (org-mode)) ;; Insert `romanized-text' at the top. (insert (concat romanized-text "\n" ;; Insert a level 1 org headline for each segment. (cl-loop for part in romanized-info concat (concat "* " (car part) " = " (cdr part) "\n\n")))) ;; Fold headlines on initial load. (org-cycle '(4)) (view-mode 1) )))⏱ 1w↩ 1