aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarty hiatt <martianhiatus [a t] riseup [d o t] net>2022-11-22 13:27:16 +0100
committermarty hiatt <martianhiatus [a t] riseup [d o t] net>2022-11-22 13:27:16 +0100
commit12cc327e7361065fa2b280e670496250e5163834 (patch)
tree801860b6d68c76e1e8173845e57b4f76a7304112
parent523efc5bc6630cdcd455513aa3640492c41ab6ef (diff)
choose language, return ISO code
-rw-r--r--lisp/mastodon-toot.el13
1 files changed, 12 insertions, 1 deletions
diff --git a/lisp/mastodon-toot.el b/lisp/mastodon-toot.el
index 5a735dc..b3d8860 100644
--- a/lisp/mastodon-toot.el
+++ b/lisp/mastodon-toot.el
@@ -47,6 +47,8 @@
(declare-function company-grab-symbol "company")
(defvar company-backends))
+(require 'mastodon-iso)
+
(defvar mastodon-instance-url)
(defvar mastodon-tl--buffer-spec)
(defvar mastodon-tl--enable-proportional-fonts)
@@ -1141,6 +1143,16 @@ LENGTH is the maximum character length allowed for a poll option."
("14 days" . ,(number-to-string (* 60 60 24 14)))
("30 days" . ,(number-to-string (* 60 60 24 30)))))
+(defun mastodon-toot--prompt-toot-lang ()
+ "Prompt for a language and return its two letter ISO 639 1 code."
+ (let* ((langs (mapcar (lambda (x)
+ (cons (cadr x)
+ (car x)))
+ mastodon-iso-639-1))
+ (choice (completing-read "Language for this toot: "
+ langs)))
+ (alist-get choice langs nil nil 'equal)))
+
;; we'll need to revisit this if the binds get
;; more diverse than two-chord bindings
(defun mastodon-toot--get-mode-kbinds ()
@@ -1329,7 +1341,6 @@ This is how mastodon does it."
(replace-match (match-string 2))) ; replace with handle only
(length (buffer-substring (point-min) (point-max)))))
-
(defun mastodon-toot--save-toot-text (&rest _args)
"Save the current toot text in `mastodon-toot-current-toot-text'.
Added to `after-change-functions' in new toot buffers."