From: Kevin McCarthy Date: Tue, 23 Aug 2016 03:04:59 +0000 (-0700) Subject: Add $attribution_locale configuration variable. X-Git-Tag: neomutt-20170225~32^2~132 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8aba5619666d6d23ef224f61b1c071b60fa9a6b7;p=neomutt Add $attribution_locale configuration variable. $attribution_locale replaces the just removed $locale, but is only used for customizing the LC_TIME locale used for dates in $attribution. This could be useful in conjunction with folder or send-hooks for recipients in different locales. --- diff --git a/doc/manual.xml.head b/doc/manual.xml.head index ac22afa76..231386070 100644 --- a/doc/manual.xml.head +++ b/doc/manual.xml.head @@ -3624,8 +3624,8 @@ Example: send-hook mutt Another typical use for this command is to change the values of the $attribution, $signature and $locale variables in order to change the +linkend="attribution-locale">$attribution_locale, and $signature variables in order to change the language of the attributions and signatures based upon the recipients. diff --git a/edit.c b/edit.c index 00d8afb61..719c491e6 100644 --- a/edit.c +++ b/edit.c @@ -160,7 +160,9 @@ be_include_messages (char *msg, char **buf, int *bufmax, int *buflen, /* add the attribution */ if (Attribution) { + setlocale (LC_TIME, NONULL (AttributionLocale)); mutt_make_string (tmp, sizeof (tmp) - 1, Attribution, Context, Context->hdrs[n]); + setlocale (LC_TIME, ""); strcat (tmp, "\n"); /* __STRCAT_CHECKED__ */ } diff --git a/globals.h b/globals.h index 27caae74d..7be9fff80 100644 --- a/globals.h +++ b/globals.h @@ -36,6 +36,7 @@ WHERE char *AliasFmt; WHERE char *AssumedCharset; WHERE char *AttachSep; WHERE char *Attribution; +WHERE char *AttributionLocale; WHERE char *AttachCharset; WHERE char *AttachFormat; WHERE char *Charset; diff --git a/init.h b/init.h index c0159772e..344464dc0 100644 --- a/init.h +++ b/init.h @@ -266,6 +266,18 @@ struct option_t MuttVars[] = { ** in a reply. For a full listing of defined \fCprintf(3)\fP-like sequences see ** the section on $$index_format. */ + { "attribution_locale", DT_STR, R_NONE, UL &AttributionLocale, UL "" }, + /* + ** .pp + ** The locale used by \fCstrftime(3)\fP to format dates in the + ** $attribution string. Legal values are the strings your system + ** accepts for the locale environment variable \fC$$$LC_TIME\fP. + ** .pp + ** This variable is to allow the attribution date format to be + ** customized by recipient or folder using hooks. By default, Mutt + ** will use your locale environment, so there is no need to set + ** this except to override that default. + */ { "auto_tag", DT_BOOL, R_NONE, OPTAUTOTAG, 0 }, /* ** .pp @@ -599,8 +611,8 @@ struct option_t MuttVars[] = { ** function to process the date, see the man page for the proper syntax. ** .pp ** Unless the first character in the string is a bang (``!''), the month - ** and week day names are expanded according to the locale specified in - ** the variable $$locale. If the first character in the string is a + ** and week day names are expanded according to the locale. + ** If the first character in the string is a ** bang, the bang is discarded, and the month and week day names in the ** rest of the string are expanded in the \fIC\fP locale (that is in US ** English). diff --git a/send.c b/send.c index d54d4951d..49e4ec409 100644 --- a/send.c +++ b/send.c @@ -401,7 +401,9 @@ void mutt_make_attribution (CONTEXT *ctx, HEADER *cur, FILE *out) char buffer[LONG_STRING]; if (Attribution) { + setlocale (LC_TIME, NONULL (AttributionLocale)); mutt_make_string (buffer, sizeof (buffer), Attribution, ctx, cur); + setlocale (LC_TIME, ""); fputs (buffer, out); fputc ('\n', out); }