From 279aabbbeed7e12f7034d11c83079a7e6fdaeedd Mon Sep 17 00:00:00 2001
From: marty hiatt <martianhiatus [a t] riseup [d o t] net>
Date: Sun, 27 Nov 2022 13:42:57 +0100
Subject: compose buffer - display language selection only when selected

---
 lisp/mastodon-toot.el | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

(limited to 'lisp')

diff --git a/lisp/mastodon-toot.el b/lisp/mastodon-toot.el
index 40ff0ee..28733e1 100644
--- a/lisp/mastodon-toot.el
+++ b/lisp/mastodon-toot.el
@@ -1211,6 +1211,9 @@ REPLY-TEXT is the text of the toot being replied to."
        (propertize "Visibility"
                    'toot-post-visibility t)
        " ⋅ "
+       (propertize "Language"
+                   'toot-post-language t)
+       " "
        (propertize "CW"
                    'toot-post-cw-flag t)
        " "
@@ -1264,6 +1267,8 @@ REPLY-JSON is the full JSON of the toot being replied to."
                                                           (point-min)))
            (cw-region (mastodon-tl--find-property-range 'toot-post-cw-flag
                                                         (point-min)))
+           (lang-region (mastodon-tl--find-property-range 'toot-post-language
+                                                          (point-min)))
            (toot-string (buffer-substring-no-properties (cdr header-region)
                                                         (point-max))))
       (add-text-properties (car count-region) (cdr count-region)
@@ -1279,10 +1284,16 @@ REPLY-JSON is the full JSON of the toot being replied to."
                                               "private")
                                              "followers-only"
                                            mastodon-toot--visibility))))
+      (add-text-properties (car lang-region) (cdr lang-region)
+                           (list 'display
+                                 (if mastodon-toot--language
+                                     (format "Language: %s"
+                                             mastodon-toot--language)
+                                   "")))
       (add-text-properties (car nsfw-region) (cdr nsfw-region)
                            (list 'display (if mastodon-toot--content-nsfw
                                               (if mastodon-toot--media-attachments
-                                                  "NSFW" "NSFW (no effect until attachments added)")
+                                                  "NSFW" "NSFW (for attachments only)")
                                             "")
                                  'face 'mastodon-cw-face))
       (add-text-properties (car cw-region) (cdr cw-region)
-- 
cgit v1.2.3