aboutsummaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authordefault <nobody@localhost>2025-01-05 09:34:00 +0100
committerdefault <nobody@localhost>2025-01-05 09:34:00 +0100
commit3a1cae73265aebdbe678d94fbdc16edf3ccc643f (patch)
tree3c50341495d370dfeb7bfe0312ad5644d9c8f865 /main.c
parent17d7e0027abb48040ef989b1894bcd0bc28c9faa (diff)
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[])
else
content = xs_dup(url);
- msg = msg_note(&snac, content, NULL, NULL, attl, 0);
-
- /* set a post language according the LANG environment variable */
- const char *lang_env = getenv("LANG");
- if (xs_type(lang_env) == XSTYPE_STRING) {
- /* split at the first _ */
- xs *l0 = xs_split(lang_env, "_");
- const char *lang = xs_list_get(l0, 0);
-
- if (xs_type(lang) == XSTYPE_STRING && strlen(lang) == 2) {
- /* a valid ISO language id */
- xs *cmap = xs_dict_new();
- cmap = xs_dict_set(cmap, lang, xs_dict_get(msg, "content"));
- msg = xs_dict_set(msg, "contentMap", cmap);
- }
- }
+ msg = msg_note(&snac, content, NULL, NULL, attl, 0, getenv("LANG"));
c_msg = msg_create(&snac, msg);