summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorGravatar default2025-01-05 09:34:00 +0100
committerGravatar default2025-01-05 09:34:00 +0100
commit3a1cae73265aebdbe678d94fbdc16edf3ccc643f (patch)
tree3c50341495d370dfeb7bfe0312ad5644d9c8f865 /main.c
parentUse the site's CSS in the /share page. (diff)
downloadpenes-snac2-3a1cae73265aebdbe678d94fbdc16edf3ccc643f.tar.gz
penes-snac2-3a1cae73265aebdbe678d94fbdc16edf3ccc643f.tar.xz
penes-snac2-3a1cae73265aebdbe678d94fbdc16edf3ccc643f.zip
Moved post language setting to msg_note(), where it really belongs.
On the way, posting from the Mastodon API sets the language accordingly.
Diffstat (limited to 'main.c')
-rw-r--r--main.c17
1 files changed, 1 insertions, 16 deletions
diff --git a/main.c b/main.c
index 94d989c..7a86fbd 100644
--- a/main.c
+++ b/main.c
@@ -667,22 +667,7 @@ int main(int argc, char *argv[])
667 else 667 else
668 content = xs_dup(url); 668 content = xs_dup(url);
669 669
670 msg = msg_note(&snac, content, NULL, NULL, attl, 0); 670 msg = msg_note(&snac, content, NULL, NULL, attl, 0, getenv("LANG"));
671
672 /* set a post language according the LANG environment variable */
673 const char *lang_env = getenv("LANG");
674 if (xs_type(lang_env) == XSTYPE_STRING) {
675 /* split at the first _ */
676 xs *l0 = xs_split(lang_env, "_");
677 const char *lang = xs_list_get(l0, 0);
678
679 if (xs_type(lang) == XSTYPE_STRING && strlen(lang) == 2) {
680 /* a valid ISO language id */
681 xs *cmap = xs_dict_new();
682 cmap = xs_dict_set(cmap, lang, xs_dict_get(msg, "content"));
683 msg = xs_dict_set(msg, "contentMap", cmap);
684 }
685 }
686 671
687 c_msg = msg_create(&snac, msg); 672 c_msg = msg_create(&snac, msg);
688 673