]> granicus.if.org Git - neomutt/commitdiff
Add $attribution_locale configuration variable.
authorKevin McCarthy <kevin@8t8.us>
Tue, 23 Aug 2016 03:04:59 +0000 (20:04 -0700)
committerRichard Russon <rich@flatcap.org>
Tue, 13 Sep 2016 15:15:01 +0000 (16:15 +0100)
$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.

doc/manual.xml.head
edit.c
globals.h
init.h
send.c

index 85bcbed22fe2109e046c30401eb853b2e1a359d1..db1da8de432f29f9948b58d2fbab9e6e61695537 100644 (file)
@@ -4274,8 +4274,8 @@ Example: <literal><command>send-hook</command> mutt
 <para>
 Another typical use for this command is to change the values of the
 <link linkend="attribution">$attribution</link>, <link
-linkend="signature">$signature</link> and <link
-linkend="locale">$locale</link> variables in order to change the
+linkend="attribution-locale">$attribution_locale</link>, and <link
+linkend="signature">$signature</link> variables in order to change the
 language of the attributions and signatures based upon the recipients.
 </para>
 
diff --git a/edit.c b/edit.c
index 00d8afb613374c8dcb8ec91313a8526f14b16161..719c491e60e0f024fe3512ad4a9116c06853da13 100644 (file)
--- 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__ */
       }
 
index e76ebb6fd3fa962c9f2b02e3f8971a75569f6836..31f6b151e183e22d3fffc3f528a4ff6a190efdaa 100644 (file)
--- 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 *AttachKeyword;
diff --git a/init.h b/init.h
index d45091879691be2d70969b903416e2d9f5ef809d..d03c6aa0211d2a5a852a0980d6908a22d9961a10 100644 (file)
--- a/init.h
+++ b/init.h
@@ -296,6 +296,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
@@ -650,8 +662,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 bceb4574ba159e7bb27bff96534d9ce3c18bd1b0..f1b6d493220f4b26fa31027d1604e9186db78d83 100644 (file)
--- a/send.c
+++ b/send.c
@@ -469,7 +469,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);
   }