mirror of https://codeberg.org/cage/tinmop/
- added language parameter for each post sent.
This commit is contained in:
parent
8486e6eea4
commit
ef90f3ad43
|
@ -41,6 +41,11 @@ editor = "nano --locking"
|
||||||
|
|
||||||
post-allowed-language = ".*"
|
post-allowed-language = ".*"
|
||||||
|
|
||||||
|
# default language code por posts sent, the list can be found here:
|
||||||
|
# https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
|
||||||
|
|
||||||
|
default.post.language = "en"
|
||||||
|
|
||||||
# update gemlog subscriptions when program starts
|
# update gemlog subscriptions when program starts
|
||||||
# (default 'no', change to 'yes' if desired)
|
# (default 'no', change to 'yes' if desired)
|
||||||
start.update.gemlog = no
|
start.update.gemlog = no
|
||||||
|
|
|
@ -502,7 +502,9 @@ database."
|
||||||
in-reply-to-id
|
in-reply-to-id
|
||||||
attachments
|
attachments
|
||||||
attachments-alt-text
|
attachments-alt-text
|
||||||
subject visibility)
|
subject
|
||||||
|
visibility
|
||||||
|
language)
|
||||||
"Send a status
|
"Send a status
|
||||||
- content the actual text of the message
|
- content the actual text of the message
|
||||||
- in-reply-to-id status-id of the message you are replying to (or nil
|
- in-reply-to-id status-id of the message you are replying to (or nil
|
||||||
|
@ -513,6 +515,7 @@ database."
|
||||||
- visibility one of `swconf:*allowed-status-visibility*'"
|
- visibility one of `swconf:*allowed-status-visibility*'"
|
||||||
(tooter:make-status *client*
|
(tooter:make-status *client*
|
||||||
content
|
content
|
||||||
|
:language language
|
||||||
:in-reply-to in-reply-to-id
|
:in-reply-to in-reply-to-id
|
||||||
:media (mapcar (lambda (path alt-text)
|
:media (mapcar (lambda (path alt-text)
|
||||||
(tooter:make-media *client*
|
(tooter:make-media *client*
|
||||||
|
|
|
@ -128,7 +128,7 @@ completed) and the common prefix of the completion string."
|
||||||
(defmacro with-simple-complete (function-name all-choices-list-fn)
|
(defmacro with-simple-complete (function-name all-choices-list-fn)
|
||||||
"Generate a complete function using function-name to build the name
|
"Generate a complete function using function-name to build the name
|
||||||
the function and `all-choices-list-fn' as a function that returns a
|
the function and `all-choices-list-fn' as a function that returns a
|
||||||
list af all possible candidtae for completion."
|
list af all possible candidates for completion."
|
||||||
(with-gensyms (matched)
|
(with-gensyms (matched)
|
||||||
`(defun ,(misc:format-fn-symbol t "~a" function-name) (hint)
|
`(defun ,(misc:format-fn-symbol t "~a" function-name) (hint)
|
||||||
(when-let ((,matched (remove-if-not (starts-with-clsr hint)
|
(when-let ((,matched (remove-if-not (starts-with-clsr hint)
|
||||||
|
@ -269,6 +269,9 @@ list af all possible candidtae for completion."
|
||||||
(with-simple-complete bookmark-section-complete
|
(with-simple-complete bookmark-section-complete
|
||||||
(lambda () (remove-if #'null (db:bookmark-all-sections))))
|
(lambda () (remove-if #'null (db:bookmark-all-sections))))
|
||||||
|
|
||||||
|
(with-simple-complete language-codes
|
||||||
|
(lambda () constants:+language-codes+))
|
||||||
|
|
||||||
(defun quote-hint (a)
|
(defun quote-hint (a)
|
||||||
(cl-ppcre:quote-meta-chars a))
|
(cl-ppcre:quote-meta-chars a))
|
||||||
|
|
||||||
|
|
|
@ -174,3 +174,188 @@ General Public License for more details."
|
||||||
(define-constant +internal-path-bookmark+ "bookmark" :test #'string=)
|
(define-constant +internal-path-bookmark+ "bookmark" :test #'string=)
|
||||||
|
|
||||||
(define-constant +internal-path-gemlogs+ "gemlog" :test #'string=)
|
(define-constant +internal-path-gemlogs+ "gemlog" :test #'string=)
|
||||||
|
|
||||||
|
(define-constant +language-codes+ '("ab"
|
||||||
|
"aar"
|
||||||
|
"af"
|
||||||
|
"aka"
|
||||||
|
"sq"
|
||||||
|
"am"
|
||||||
|
"ara"
|
||||||
|
"an"
|
||||||
|
"hy"
|
||||||
|
"as"
|
||||||
|
"ava"
|
||||||
|
"ae"
|
||||||
|
"aym"
|
||||||
|
"az"
|
||||||
|
"bm"
|
||||||
|
"ba"
|
||||||
|
"eus"
|
||||||
|
"be"
|
||||||
|
"bn"
|
||||||
|
"bi"
|
||||||
|
"bs"
|
||||||
|
"bre"
|
||||||
|
"bg"
|
||||||
|
"my"
|
||||||
|
"an"
|
||||||
|
"ch"
|
||||||
|
"ce"
|
||||||
|
"ny"
|
||||||
|
"zh"
|
||||||
|
"cu"
|
||||||
|
"cv"
|
||||||
|
"kw"
|
||||||
|
"co"
|
||||||
|
"cre"
|
||||||
|
"hr"
|
||||||
|
"ces"
|
||||||
|
"dan"
|
||||||
|
"dv"
|
||||||
|
"nl"
|
||||||
|
"dz"
|
||||||
|
"en"
|
||||||
|
"eo"
|
||||||
|
"et"
|
||||||
|
"ewe"
|
||||||
|
"fo"
|
||||||
|
"fij"
|
||||||
|
"fi"
|
||||||
|
"fra"
|
||||||
|
"fy"
|
||||||
|
"ful"
|
||||||
|
"gd"
|
||||||
|
"gl"
|
||||||
|
"lug"
|
||||||
|
"ka"
|
||||||
|
"deu"
|
||||||
|
"el"
|
||||||
|
"kl"
|
||||||
|
"gn"
|
||||||
|
"gu"
|
||||||
|
"ht"
|
||||||
|
"hau"
|
||||||
|
"heb"
|
||||||
|
"her"
|
||||||
|
"hin"
|
||||||
|
"ho"
|
||||||
|
"hu"
|
||||||
|
"is"
|
||||||
|
"ido"
|
||||||
|
"ibo"
|
||||||
|
"id"
|
||||||
|
"ia"
|
||||||
|
"ie"
|
||||||
|
"iu"
|
||||||
|
"ik"
|
||||||
|
"gle"
|
||||||
|
"it"
|
||||||
|
"ja"
|
||||||
|
"jv"
|
||||||
|
"kn"
|
||||||
|
"kau"
|
||||||
|
"ks"
|
||||||
|
"kaz"
|
||||||
|
"km"
|
||||||
|
"ki"
|
||||||
|
"rw"
|
||||||
|
"ky"
|
||||||
|
"kom"
|
||||||
|
"kon"
|
||||||
|
"kor"
|
||||||
|
"ma"
|
||||||
|
"ku"
|
||||||
|
"lao"
|
||||||
|
"lat"
|
||||||
|
"lv"
|
||||||
|
"li"
|
||||||
|
"ln"
|
||||||
|
"lt"
|
||||||
|
"lu"
|
||||||
|
"lb"
|
||||||
|
"mk"
|
||||||
|
"mg"
|
||||||
|
"msa"
|
||||||
|
"ml"
|
||||||
|
"mt"
|
||||||
|
"glv"
|
||||||
|
"mri"
|
||||||
|
"mr"
|
||||||
|
"mh"
|
||||||
|
"mn"
|
||||||
|
"nau"
|
||||||
|
"nv"
|
||||||
|
"nd"
|
||||||
|
"nr"
|
||||||
|
"ndo"
|
||||||
|
"nep"
|
||||||
|
"no"
|
||||||
|
"nb"
|
||||||
|
"nn"
|
||||||
|
"ii"
|
||||||
|
"oc"
|
||||||
|
"oji"
|
||||||
|
"ori"
|
||||||
|
"orm"
|
||||||
|
"os"
|
||||||
|
"pli"
|
||||||
|
"ps"
|
||||||
|
"fa"
|
||||||
|
"pol"
|
||||||
|
"pt"
|
||||||
|
"pa"
|
||||||
|
"qu"
|
||||||
|
"ro"
|
||||||
|
"rm"
|
||||||
|
"run"
|
||||||
|
"ru"
|
||||||
|
"se"
|
||||||
|
"smo"
|
||||||
|
"sag"
|
||||||
|
"sa"
|
||||||
|
"sc"
|
||||||
|
"sr"
|
||||||
|
"sna"
|
||||||
|
"snd"
|
||||||
|
"se"
|
||||||
|
"slk"
|
||||||
|
"sl"
|
||||||
|
"som"
|
||||||
|
"st"
|
||||||
|
"an"
|
||||||
|
"su"
|
||||||
|
"sw"
|
||||||
|
"ssw"
|
||||||
|
"sv"
|
||||||
|
"tl"
|
||||||
|
"ty"
|
||||||
|
"tgk"
|
||||||
|
"tam"
|
||||||
|
"tat"
|
||||||
|
"tel"
|
||||||
|
"tha"
|
||||||
|
"bo"
|
||||||
|
"ti"
|
||||||
|
"to"
|
||||||
|
"tso"
|
||||||
|
"tsn"
|
||||||
|
"tr"
|
||||||
|
"tk"
|
||||||
|
"twi"
|
||||||
|
"ug"
|
||||||
|
"uk"
|
||||||
|
"urd"
|
||||||
|
"uzb"
|
||||||
|
"ven"
|
||||||
|
"vi"
|
||||||
|
"vo"
|
||||||
|
"wa"
|
||||||
|
"cym"
|
||||||
|
"wol"
|
||||||
|
"xho"
|
||||||
|
"yi"
|
||||||
|
"yor"
|
||||||
|
"za"
|
||||||
|
"zul")
|
||||||
|
:test #'equalp)
|
||||||
|
|
|
@ -75,6 +75,7 @@
|
||||||
:+internal-scheme+
|
:+internal-scheme+
|
||||||
:+internal-path-bookmark+
|
:+internal-path-bookmark+
|
||||||
:+internal-path-gemlogs+
|
:+internal-path-gemlogs+
|
||||||
|
:+language-codes+
|
||||||
;; GUI
|
;; GUI
|
||||||
:+minimum-padding+
|
:+minimum-padding+
|
||||||
:+ps-file-dialog-filter+
|
:+ps-file-dialog-filter+
|
||||||
|
@ -1432,6 +1433,7 @@
|
||||||
:config-gopher-line-prefix-search-index
|
:config-gopher-line-prefix-search-index
|
||||||
:config-gopher-line-prefix-attribute
|
:config-gopher-line-prefix-attribute
|
||||||
:config-gopher-line-prefix-foreground
|
:config-gopher-line-prefix-foreground
|
||||||
|
:config-default-post-language
|
||||||
:link-regex->program-to-use
|
:link-regex->program-to-use
|
||||||
:link-regex->program-to-use-buffer-size
|
:link-regex->program-to-use-buffer-size
|
||||||
:use-tinmop-as-external-program-p
|
:use-tinmop-as-external-program-p
|
||||||
|
@ -1597,7 +1599,8 @@
|
||||||
:complete-chat-message
|
:complete-chat-message
|
||||||
:complete-always-empty
|
:complete-always-empty
|
||||||
:bookmark-section-complete
|
:bookmark-section-complete
|
||||||
:bookmark-description-complete-clsr))
|
:bookmark-description-complete-clsr
|
||||||
|
:language-codes))
|
||||||
|
|
||||||
(defpackage :program-events
|
(defpackage :program-events
|
||||||
(:use
|
(:use
|
||||||
|
@ -2657,6 +2660,7 @@
|
||||||
(:local-nicknames (:c :croatoan))
|
(:local-nicknames (:c :croatoan))
|
||||||
(:export
|
(:export
|
||||||
:message-ready-to-send
|
:message-ready-to-send
|
||||||
|
:language
|
||||||
:subject
|
:subject
|
||||||
:attachments
|
:attachments
|
||||||
:reply-to
|
:reply-to
|
||||||
|
|
|
@ -19,7 +19,11 @@
|
||||||
(define-constant +header-send-window-height+ 5 :test #'=)
|
(define-constant +header-send-window-height+ 5 :test #'=)
|
||||||
|
|
||||||
(defclass message-ready-to-send ()
|
(defclass message-ready-to-send ()
|
||||||
((subject
|
((language
|
||||||
|
:initform nil
|
||||||
|
:initarg :language
|
||||||
|
:accessor language)
|
||||||
|
(subject
|
||||||
:initform nil
|
:initform nil
|
||||||
:initarg :subject
|
:initarg :subject
|
||||||
:accessor subject)
|
:accessor subject)
|
||||||
|
@ -107,7 +111,8 @@
|
||||||
(body body)
|
(body body)
|
||||||
(subject subject)
|
(subject subject)
|
||||||
(mentions mentions)
|
(mentions mentions)
|
||||||
(visibility visibility)) message-data
|
(visibility visibility)
|
||||||
|
(language language)) message-data
|
||||||
(with-croatoan-window (croatoan-window object)
|
(with-croatoan-window (croatoan-window object)
|
||||||
(let* ((bgcolor (c:bgcolor croatoan-window))
|
(let* ((bgcolor (c:bgcolor croatoan-window))
|
||||||
(fgcolor (c:fgcolor croatoan-window))
|
(fgcolor (c:fgcolor croatoan-window))
|
||||||
|
@ -120,14 +125,17 @@
|
||||||
(label-mentions-raw (_ "Mentions: "))
|
(label-mentions-raw (_ "Mentions: "))
|
||||||
(label-subject-raw (_ "Subject: "))
|
(label-subject-raw (_ "Subject: "))
|
||||||
(label-visibility-raw (_ "Visibility: "))
|
(label-visibility-raw (_ "Visibility: "))
|
||||||
|
(label-language-raw (_ "Language: "))
|
||||||
(label-reply-length-raw (length label-reply-raw))
|
(label-reply-length-raw (length label-reply-raw))
|
||||||
(label-mentions-length-raw (length label-mentions-raw))
|
(label-mentions-length-raw (length label-mentions-raw))
|
||||||
(label-subject-raw-length (length label-subject-raw))
|
(label-subject-raw-length (length label-subject-raw))
|
||||||
(label-visibility-raw-length (length label-visibility-raw))
|
(label-visibility-raw-length (length label-visibility-raw))
|
||||||
|
(label-language-raw-length (length label-language-raw))
|
||||||
(max-field-length (max label-reply-length-raw
|
(max-field-length (max label-reply-length-raw
|
||||||
label-mentions-length-raw
|
label-mentions-length-raw
|
||||||
label-subject-raw-length
|
label-subject-raw-length
|
||||||
label-visibility-raw-length))
|
label-visibility-raw-length
|
||||||
|
label-language-raw-length))
|
||||||
(label-subject (text-utils:right-padding label-subject-raw
|
(label-subject (text-utils:right-padding label-subject-raw
|
||||||
max-field-length))
|
max-field-length))
|
||||||
(label-reply (text-utils:right-padding label-reply-raw
|
(label-reply (text-utils:right-padding label-reply-raw
|
||||||
|
@ -136,6 +144,8 @@
|
||||||
max-field-length))
|
max-field-length))
|
||||||
(label-visibility (text-utils:right-padding label-visibility-raw
|
(label-visibility (text-utils:right-padding label-visibility-raw
|
||||||
max-field-length))
|
max-field-length))
|
||||||
|
(label-language (text-utils:right-padding label-language-raw
|
||||||
|
max-field-length))
|
||||||
(value-max-length (- (win-width-no-border object)
|
(value-max-length (- (win-width-no-border object)
|
||||||
max-field-length))
|
max-field-length))
|
||||||
(label-attachments (_ "Attachments")))
|
(label-attachments (_ "Attachments")))
|
||||||
|
@ -171,11 +181,17 @@
|
||||||
max-field-length
|
max-field-length
|
||||||
4
|
4
|
||||||
input-bg input-fg)
|
input-bg input-fg)
|
||||||
|
(print-field label-language 1 5 bgcolor fgcolor)
|
||||||
|
(print-field (right-padding language
|
||||||
|
value-max-length)
|
||||||
|
max-field-length
|
||||||
|
5
|
||||||
|
input-bg input-fg)
|
||||||
(print-field (right-padding (text-ellipsis label-attachments
|
(print-field (right-padding (text-ellipsis label-attachments
|
||||||
(win-width-no-border object))
|
(win-width-no-border object))
|
||||||
(win-width-no-border object))
|
(win-width-no-border object))
|
||||||
1
|
1
|
||||||
5
|
6
|
||||||
bgcolor fgcolor
|
bgcolor fgcolor
|
||||||
:inverse t)))))))
|
:inverse t)))))))
|
||||||
|
|
||||||
|
|
|
@ -480,7 +480,8 @@
|
||||||
,@(loop for name in names collect
|
,@(loop for name in names collect
|
||||||
`(gen-key-constant ,name))))
|
`(gen-key-constant ,name))))
|
||||||
|
|
||||||
(gen-key-constants unknown
|
(gen-key-constants default
|
||||||
|
unknown
|
||||||
experimental
|
experimental
|
||||||
regex
|
regex
|
||||||
background
|
background
|
||||||
|
@ -635,6 +636,8 @@
|
||||||
ignore-user-boost-re
|
ignore-user-boost-re
|
||||||
ignore-tag-re
|
ignore-tag-re
|
||||||
post-allowed-language
|
post-allowed-language
|
||||||
|
post
|
||||||
|
language
|
||||||
purge-history-days-offset
|
purge-history-days-offset
|
||||||
purge-cache-days-offset
|
purge-cache-days-offset
|
||||||
mentions
|
mentions
|
||||||
|
@ -1592,6 +1595,13 @@
|
||||||
window-key
|
window-key
|
||||||
+key-input+
|
+key-input+
|
||||||
+key-foreground+))))
|
+key-foreground+))))
|
||||||
|
|
||||||
|
(gen-simple-access (default-post-language
|
||||||
|
:transform-value-fn identity)
|
||||||
|
+key-default+
|
||||||
|
+key-post+
|
||||||
|
+key-language+)
|
||||||
|
|
||||||
;;;;;; tests
|
;;;;;; tests
|
||||||
|
|
||||||
(defun trivial-configuration-missing-value-check ()
|
(defun trivial-configuration-missing-value-check ()
|
||||||
|
@ -1619,6 +1629,7 @@
|
||||||
#'message-window-unlocked-account-mark
|
#'message-window-unlocked-account-mark
|
||||||
#'message-window-line-mark-values
|
#'message-window-line-mark-values
|
||||||
#'message-window-attachments-header
|
#'message-window-attachments-header
|
||||||
#'config-post-allowed-language)
|
#'config-post-allowed-language
|
||||||
|
#'config-default-post-language)
|
||||||
do
|
do
|
||||||
(funcall fn)))
|
(funcall fn)))
|
||||||
|
|
|
@ -1376,6 +1376,17 @@ It an existing file path is provided the command will refuse to run."
|
||||||
:direction :output
|
:direction :output
|
||||||
:element-type 'character)
|
:element-type 'character)
|
||||||
(format stream "~a~%" message-header-text))))
|
(format stream "~a~%" message-header-text))))
|
||||||
|
(add-language ()
|
||||||
|
(flet ((on-add-language (language-code)
|
||||||
|
(setf (sending-message:language *message-to-send*)
|
||||||
|
language-code)
|
||||||
|
(if (member language-code +language-codes+ :test #'string=)
|
||||||
|
(add-subject)
|
||||||
|
(add-language))))
|
||||||
|
(ask-string-input #'on-add-language
|
||||||
|
:initial-value (swconf:config-default-post-language)
|
||||||
|
:prompt (_ "Add language of the post: ")
|
||||||
|
:complete-fn #'complete:language-codes)))
|
||||||
(add-body ()
|
(add-body ()
|
||||||
(let ((temp-file (fs:temporary-file)))
|
(let ((temp-file (fs:temporary-file)))
|
||||||
(insert-header-text temp-file)
|
(insert-header-text temp-file)
|
||||||
|
@ -1392,7 +1403,7 @@ It an existing file path is provided the command will refuse to run."
|
||||||
reference-open-file))
|
reference-open-file))
|
||||||
(let ((body (fs:slurp-file temp-file)))
|
(let ((body (fs:slurp-file temp-file)))
|
||||||
(setf (sending-message:body *message-to-send*) body)
|
(setf (sending-message:body *message-to-send*) body)
|
||||||
(add-subject)))))))
|
(add-language)))))))
|
||||||
(add-body)))
|
(add-body)))
|
||||||
|
|
||||||
(defun actual-author-message-id (message-row)
|
(defun actual-author-message-id (message-row)
|
||||||
|
|
Loading…
Reference in New Issue