diff --git a/src/l10n.h b/src/l10n.h index fbe59c2..3c8a014 100644 --- a/src/l10n.h +++ b/src/l10n.h @@ -100,6 +100,7 @@ enum l10n_string L10N_VIS_PRIVATE, L10N_VIS_DIRECT, L10N_VIS_LOCAL, + L10N_VIS_LIST, /* LOGIN */ L10N_LOGIN, @@ -200,6 +201,7 @@ static const char* const L10N[][_L10N_LEN] = { "Private", "Direct", "Local", + "List", /* LOGIN */ "Login", @@ -297,6 +299,7 @@ static const char* const L10N[][_L10N_LEN] = { "Private", "Direct", "Local", + "List", /* LOGIN */ "Login", @@ -394,6 +397,7 @@ static const char* const L10N[][_L10N_LEN] = { "私密", "私訊", "本地", + "List", /* LOGIN */ "登入", diff --git a/src/status.c b/src/status.c index 7c0ca0d..bc1f53c 100644 --- a/src/status.c +++ b/src/status.c @@ -134,6 +134,27 @@ void content_status_react(struct session* ssn, mastodont_t* api, char** data) redirect(REDIRECT_303, referer); } +const char* status_visibility_str(enum l10n_locale loc, + enum mstdnt_visibility_type vis) +{ + switch (vis) + { + case MSTDNT_VISIBILITY_UNLISTED: + return L10N[loc][L10N_VIS_UNLISTED]; + case MSTDNT_VISIBILITY_PRIVATE: + return L10N[loc][L10N_VIS_PRIVATE]; + case MSTDNT_VISIBILITY_DIRECT: + return L10N[loc][L10N_VIS_DIRECT]; + case MSTDNT_VISIBILITY_LOCAL: + return L10N[loc][L10N_VIS_LOCAL]; + case MSTDNT_VISIBILITY_LIST: + return L10N[loc][L10N_VIS_LIST]; + case MSTDNT_VISIBILITY_PUBLIC: + default: + return L10N[loc][L10N_VIS_PUBLIC]; + } +} + int try_interact_status(struct session* ssn, mastodont_t* api, char* id) { int res = 0; @@ -570,6 +591,7 @@ char* construct_status(struct session* ssn, char* delete_status = NULL; char* pin_status = NULL; char* interactions_html = NULL; + enum l10n_locale locale = l10n_normalize(ssn->config.lang); struct mstdnt_status* status = local_status; // Create a "fake" notification header which contains information for // the reblogged status @@ -698,7 +720,7 @@ char* construct_status(struct session* ssn, .username = formatted_display_name, .prefix = config_url_prefix, .acct = status->account.acct, - .visibility = status->visibility, + .visibility = status_visibility_str(locale, status->visibility), .unmute = status->muted ? "un" : "", .unmute_btn = status->muted ? "Unmute thread" : "Mute thread", .unbookmark = status->bookmarked ? "un" : "", diff --git a/src/status.h b/src/status.h index f6cad65..d9a4923 100644 --- a/src/status.h +++ b/src/status.h @@ -20,6 +20,7 @@ #define STATUS_H #include #include +#include "l10n.h" #include "session.h" // Flags @@ -102,6 +103,8 @@ char* make_mentions_local(char* content); void status_view_reblogs(struct session* ssn, mastodont_t* api, char** data); void status_view_favourites(struct session* ssn, mastodont_t* api, char** data); +const char* status_visibility_str(enum l10n_locale locale, enum mstdnt_visibility_type visibility); + void content_status_interactions(struct session* ssn, mastodont_t* api, char* label,