[Asterisk-bugs] [Asterisk 0010160]: In voicemail, the language of the displayed date inside the mail (VM_DATE) doesn't take into account the system's locale.

noreply at bugs.digium.com noreply at bugs.digium.com
Fri Jul 13 05:56:15 CDT 2007


The following issue has been REOPENED. 
====================================================================== 
http://bugs.digium.com/view.php?id=10160 
====================================================================== 
Reported By:                clegall_proformatique
Assigned To:                
====================================================================== 
Project:                    Asterisk
Issue ID:                   10160
Category:                   Applications/app_voicemail
Reproducibility:            always
Severity:                   feature
Priority:                   normal
Status:                     feedback
Asterisk Version:           1.4.6 
SVN Branch (only for SVN checkouts, not tarball releases): N/A  
SVN Revision (number only!): 74042 
Disclaimer on File?:        No 
Request Review:              
====================================================================== 
Date Submitted:             07-09-2007 04:03 CDT
Last Modified:              07-13-2007 05:56 CDT
====================================================================== 
Summary:                    In voicemail, the language of the displayed date
inside the mail (VM_DATE) doesn't take into account the system's locale.
Description: 
The language of VM_DATE remains in english language whatever the system's
locales.

The setting emaildateformat in /etc/asterisk/voicemail.conf allows one to
set the order of the fields in the mail, but not its language.

This happens both in asterisk 1.2 and 1.4.

====================================================================== 

---------------------------------------------------------------------- 
 clegall_proformatique - 07-13-07 05:56  
---------------------------------------------------------------------- 
What about using strftime_l() then ?


This would give, for asterisk 1.2 (vs. svn 75031) :


Index: apps/app_voicemail.c
===================================================================
--- apps/app_voicemail.c        (revision 75031)
+++ apps/app_voicemail.c        (working copy)
@@ -49,6 +49,7 @@
 #include <sys/mman.h>
 #include <time.h>
 #include <dirent.h>
+#include <locale.h>

 #include "asterisk.h"

@@ -1685,6 +1686,7 @@
        struct vm_zone *the_zone = NULL;
        int len_passdata;
        char *passdata2;
+       locale_t loc;

        if (vmu && ast_strlen_zero(vmu->email)) {
                ast_log(LOG_WARNING, "E-mail address missing for mailbox
[%s].  E-mail will not be sent.\n", vmu->mailbox);
@@ -1735,7 +1737,8 @@
                fprintf(p, "Date: %s\n", date);

                /* Set date format for voicemail mail */
-               strftime(date, sizeof(date), emaildateformat, &tm);
+               loc = newlocale (LC_ALL_MASK, "", NULL);
+               strftime_l(date, sizeof(date), emaildateformat, &tm,
loc);

                if (*fromstring) {
                        struct ast_channel *ast = ast_channel_alloc(0);


And, for asterisk 1.4 (vs. svn 75031 too) :


Index: apps/app_voicemail.c
===================================================================
--- apps/app_voicemail.c        (revision 75031)
+++ apps/app_voicemail.c        (working copy)
@@ -66,6 +66,7 @@
 #include <sys/mman.h>
 #include <time.h>
 #include <dirent.h>
+#include <locale.h>
 #ifdef IMAP_STORAGE
 #include <ctype.h>
 #include <signal.h>
@@ -1843,6 +1844,7 @@
        struct tm tm;
        char *passdata2;
        size_t len_passdata;
+       locale_t loc;
 #ifdef IMAP_STORAGE
 #define ENDL "\r\n"
 #else
@@ -1860,7 +1862,8 @@
        fprintf(p, "Date: %s" ENDL, date);

        /* Set date format for voicemail mail */
-       strftime(date, sizeof(date), emaildateformat, &tm);
+       loc = newlocale (LC_ALL_MASK, "", NULL);
+       strftime_l(date, sizeof(date), emaildateformat, &tm, loc);

        if (*fromstring) {
                struct ast_channel *ast;


Thanks. 

Issue History 
Date Modified   Username       Field                    Change               
====================================================================== 
07-13-07 05:56  clegall_proformatiqueNote Added: 0067334                        
 
======================================================================




More information about the asterisk-bugs mailing list