I just downloaded the htdig 3.1.0b1
Great !

But, I am french and most of my customers are. So I tried to fix some hole in localization. I think having reached a acceptable level adding the following configuration items :

or: ou
and: et
not: sans
syntax_error: 'ET' ou 'OU' ou 'SANS' attendu à la place de '
time: %d/%m/%Y
size_text: octets

(examples are for french and obviously, default stay US).

You will find attached the diff file for the patch to the htsearch directory I used to handle these items.

I hope that help some non US citizen ...

By the way, did somebody got a french dictionary and synonym database ?

Regards

-- 
Gilles Bernard                    mailto:[EMAIL PROTECTED]
                                  Tel: +33 (0)1 55 30 26 06
                                  Mob: +33 (0)6 09 18 68 18
                                  Fax: +33 (0)1 43 86 93 88

DEVNET                            http://www.Devnet.Fr
39, rue du Général Foy            Tel: +33 (0) 1 55 30 26 00
75008 Paris 8ème - France         Fax: +33 (0) 1 55 30 26 26
 
../htdig-3.1.0b1/htsearch/.sniffdir et htsearch/.sniffdir sont des sous-r�pertoires 
communs.
diff -c ../htdig-3.1.0b1/htsearch/Display.cc htsearch/Display.cc
*** ../htdig-3.1.0b1/htsearch/Display.cc        Tue Sep  8 20:08:42 1998
--- htsearch/Display.cc Tue Oct 13 23:12:25 1998
***************
*** 248,259 ****
        {
            struct tm   *tm = localtime(&t);
  //                    strftime(buffer, sizeof(buffer), "%e-%h-%Y", tm);
!           strftime(buffer, sizeof(buffer), "%x", tm);
            *str << buffer;
        }
        vars.Add("MODIFIED", str);
      }
        
      vars.Add("HOPCOUNT", new String(form("%d", ref->DocHopCount())));
      vars.Add("DOCID", new String(form("%d", ref->DocID())));
        
--- 248,260 ----
        {
            struct tm   *tm = localtime(&t);
  //                    strftime(buffer, sizeof(buffer), "%e-%h-%Y", tm);
!           strftime(buffer, sizeof(buffer), config["time"], tm);
            *str << buffer;
        }
        vars.Add("MODIFIED", str);
      }
        
+     vars.Add("SIZE_TEXT", new String(config["size_text"]));
      vars.Add("HOPCOUNT", new String(form("%d", ref->DocHopCount())));
      vars.Add("DOCID", new String(form("%d", ref->DocID())));
        
***************
*** 294,302 ****
      vars.Add("RESTRICT", new String(config["restrict"]));
      vars.Add("EXCLUDE", new String(config["exclude"]));
      if (mystrcasecmp(config["match_method"], "and") == 0)
!       vars.Add("MATCH_MESSAGE", new String("all"));
      else if (mystrcasecmp(config["match_method"], "or") == 0)
!       vars.Add("MATCH_MESSAGE", new String("some"));
      vars.Add("MATCHES", new String(form("%d", nMatches)));
      vars.Add("PLURAL_MATCHES", new String(nMatches == 0 ? "" : "s"));
      vars.Add("PAGE", new String(form("%d", pageNumber)));
--- 295,305 ----
      vars.Add("RESTRICT", new String(config["restrict"]));
      vars.Add("EXCLUDE", new String(config["exclude"]));
      if (mystrcasecmp(config["match_method"], "and") == 0)
! // GB vars.Add("MATCH_MESSAGE", new String("all"));
!       vars.Add("MATCH_MESSAGE", new String("tous"));
      else if (mystrcasecmp(config["match_method"], "or") == 0)
! // GB vars.Add("MATCH_MESSAGE", new String("some"));
!       vars.Add("MATCH_MESSAGE", new String("parmis"));
      vars.Add("MATCHES", new String(form("%d", nMatches)));
      vars.Add("PLURAL_MATCHES", new String(nMatches == 0 ? "" : "s"));
      vars.Add("PAGE", new String(form("%d", pageNumber)));
Seulement dans htsearch : Makefile
diff -c ../htdig-3.1.0b1/htsearch/TemplateList.cc htsearch/TemplateList.cc
*** ../htdig-3.1.0b1/htsearch/TemplateList.cc   Tue Sep  8 20:08:42 1998
--- htsearch/TemplateList.cc    Tue Oct 13 23:08:14 1998
***************
*** 78,84 ****
            s << "$(STARSLEFT)\n";
            s << "</dt><dd>$(EXCERPT)<br>\n";
            s << "<i><a href=\"$(URL)\">$(URL)</a></i>\n";
!           s << " <font size=-1>$(MODIFIED), $(SIZE) bytes</font>\n";
            s << "</dd></dl>\n";
            t->setMatchTemplate(s);
        }
--- 78,84 ----
            s << "$(STARSLEFT)\n";
            s << "</dt><dd>$(EXCERPT)<br>\n";
            s << "<i><a href=\"$(URL)\">$(URL)</a></i>\n";
!           s << " <font size=-1>$(MODIFIED), $(SIZE) $(SIZE_TEXT)</font>\n";
            s << "</dd></dl>\n";
            t->setMatchTemplate(s);
        }
diff -c ../htdig-3.1.0b1/htsearch/htsearch.cc htsearch/htsearch.cc
*** ../htdig-3.1.0b1/htsearch/htsearch.cc       Tue Sep  8 20:10:39 1998
--- htsearch/htsearch.cc        Tue Oct 13 23:03:34 1998
***************
*** 146,151 ****
--- 146,172 ----
      if (input.exists("keywords"))
        requiredWords.Create(input["keywords"], " \t\r\n");
  
+ // Added for localization */
+     if (input.exists("or"))
+       config.Add("or", input["or"]);
+     if (input.exists("and"))
+       config.Add("and", input["and"]);
+     if (input.exists("not"))
+       config.Add("not", input["not"]);
+     if (input.exists("syntax_error"))
+       config.Add("syntax_error", input["syntax_error"]);
+     if (input.exists("time"))
+       config.Add("time", input["time"]);
+     if (input.exists("size_text"))
+       config.Add("time", input["size_text"]);
+     if (!config["or"]) config.Add("or", "or");
+     if (!config["and"]) config.Add("and", "and");
+     if (!config["not"]) config.Add("not", "not");
+     if (!config["syntax_error"])
+       config.Add("syntax_error", "expected 'AND' or 'OR' instead of '");
+     if (!config["time"]) config.Add("time", "%x");
+     if (!config["size_text"]) config.Add("size_text", "bytes");
+ 
      minimum_word_length = config.Value("minimum_word_length", minimum_word_length);
      
      Parser    *parser = new Parser();
***************
*** 164,169 ****
--- 185,191 ----
      // Convert the list of WeightWord objects to a pattern string
      // that we can compile.
      //
+ 
      createLogicalWords(searchWords, logicalWords, searchWordsPattern);
  
      //
***************
*** 234,239 ****
--- 256,263 ----
      int                       i;
      int                       wasHidden = 0;
  
+     
+ 
      for (i = 0; i < searchWords.Count(); i++)
      {
        WeightWord      *ww = (WeightWord *) searchWords[i];
***************
*** 240,250 ****
        if (!ww->isHidden)
        {
            if (strcmp(ww->word, "&") == 0 && wasHidden == 0)
!               logicalWords << " and ";
            else if (strcmp(ww->word, "|") == 0 && wasHidden == 0)
!               logicalWords << " or ";
            else if (strcmp(ww->word, "!") == 0 && wasHidden == 0)
!               logicalWords << " not ";
            else if (wasHidden == 0)
            {
                logicalWords << ww->word;
--- 264,274 ----
        if (!ww->isHidden)
        {
            if (strcmp(ww->word, "&") == 0 && wasHidden == 0)
!               logicalWords << " " << config["and"] << " ";
            else if (strcmp(ww->word, "|") == 0 && wasHidden == 0)
!               logicalWords << " " << config["or"] << " ";
            else if (strcmp(ww->word, "!") == 0 && wasHidden == 0)
!               logicalWords << " " << config["not"] << " ";
            else if (wasHidden == 0)
            {
                logicalWords << ww->word;
***************
*** 377,391 ****
                }
                word.remove(valid_punctuation);
                pos--;
!               if (boolean && mystrcasecmp(word.get(), "and") == 0)
                {
                    tempWords.Add(new WeightWord("&", -1.0));
                }
!               else if (boolean && mystrcasecmp(word.get(), "or") == 0)
                {
                    tempWords.Add(new WeightWord("|", -1.0));
                }
!               else if (boolean && mystrcasecmp(word.get(), "not") == 0)
                {
                    tempWords.Add(new WeightWord("!", -1.0));
                }
--- 401,416 ----
                }
                word.remove(valid_punctuation);
                pos--;
! // GB added et/ou/sans for french 
!               if (boolean && mystrcasecmp(word.get(), config["and"]) == 0)
                {
                    tempWords.Add(new WeightWord("&", -1.0));
                }
!               else if (boolean && mystrcasecmp(word.get(), config["or"]) == 0)
                {
                    tempWords.Add(new WeightWord("|", -1.0));
                }
!               else if (boolean && mystrcasecmp(word.get(), config["not"]) == 0)
                {
                    tempWords.Add(new WeightWord("!", -1.0));
                }
diff -c ../htdig-3.1.0b1/htsearch/parser.cc htsearch/parser.cc
*** ../htdig-3.1.0b1/htsearch/parser.cc Tue Sep  8 20:08:42 1998
--- htsearch/parser.cc  Tue Oct 13 22:05:51 1998
***************
*** 61,74 ****
        return DONE;
      else if (mystrcasecmp(current->word, "&") == 0)
        return '&';
! //    else if (mystrcasecmp(current->word, "and") == 0)
! //            return '&';
      else if (mystrcasecmp(current->word, "|") == 0)
        return '|';
      else if (mystrcasecmp(current->word, "!") == 0)
        return '!';
! //    else if (mystrcasecmp(current->word, "or") == 0)
! //            return '|';
      else if (mystrcasecmp(current->word, "(") == 0)
        return '(';
      else if (mystrcasecmp(current->word, ")") == 0)
--- 61,76 ----
        return DONE;
      else if (mystrcasecmp(current->word, "&") == 0)
        return '&';
!     else if (mystrcasecmp(current->word, config["and"]) == 0)
!       return '&';
      else if (mystrcasecmp(current->word, "|") == 0)
        return '|';
+     else if (mystrcasecmp(current->word, config["or"]) == 0)
+       return '|';
      else if (mystrcasecmp(current->word, "!") == 0)
        return '!';
!     else if (mystrcasecmp(current->word, config["not"]) == 0)
!       return '!';
      else if (mystrcasecmp(current->word, "(") == 0)
        return '(';
      else if (mystrcasecmp(current->word, ")") == 0)
***************
*** 104,110 ****
      {
        valid = 0;
        error = 0;
!       error << "expected 'AND' or 'OR' instead of '" << current->word.get();
        error << '\'';
      }
  }
--- 106,113 ----
      {
        valid = 0;
        error = 0;
! //    error << "expected 'AND' or 'OR' instead of '" << current->word.get();
!       error << config["syntax_error"] << current->word.get();
        error << '\'';
      }
  }


Reply via email to