[htdig] Bug report #554: "date_format -> $MODIFIED : locale not recognized"


Torsten Neuer (tneuer@inwise.de)
Sun, 6 Jun 1999 20:07:07 +0200


Hiyaz,

The following patch for htsearch/Display.cc solves the problem
reported by this entry.

------------------------- begin patch ----------------------------
*** htsearch/Display.cc~
--- htsearch/Display.cc
***************
*** 20,25 ****
--- 20,26 ----
  #include <stdio.h>
  #include <ctype.h>
  #include <syslog.h>
+ #include <locale.h>
  #include "HtURLCodec.h"
  #include "HtWordType.h"
  
***************
*** 318,329 ****
--- 319,335 ----
        {
            struct tm *tm = localtime(&t);
            char *datefmt = config["date_format"];
+ char *locale = config["locale"];
            if (!datefmt || !*datefmt)
              {
                if (config.Boolean("iso_8601"))
                    datefmt = "%Y-%m-%d %H:%M:%S %Z";
                else
                    datefmt = "%x";
+ }
+ if ( locale && *locale )
+ {
+ setlocale(LC_TIME,locale);
              }
            strftime(buffer, sizeof(buffer), datefmt, tm);
            *str << buffer;
-------------------------- end patch ----------------------------

The resulting htsearch binary should now display the correct name
for the month ("%B") as well as the correct short name ("%b") for
(at least) all major languages. Dialects may still display an
incorrect name / short name, however (depending upon the system's
locale installation). In this case, use the locale name for the
major language instead (e.g. use "pt_PT" instead of "pt_BR").

cheers,
  Torsten

--
InWise - Wirtschaftlich-Wissenschaftlicher Internet Service GmbH
Waldhofstraße 14                            Tel: +49-4101-403605
D-25474 Ellerbek                            Fax: +49-4101-403606
E-Mail: info@inwise.de            Internet: http://www.inwise.de

------------------------------------ To unsubscribe from the htdig mailing list, send a message to htdig@htdig.org containing the single word "unsubscribe" in the SUBJECT of the message.



This archive was generated by hypermail 2.0b3 on Sun Jun 06 1999 - 10:28:13 PDT