Package: dictionaries-common
Version: 0.98.10
Severity: wishlist
Tags: patch
User: Dmitry Katsubo <[EMAIL PROTECTED]>

On Sat, Aug 23, 2008 at 11:41:49PM +0200, Dmitry Katsubo wrote:
> Dear Agustin!
> 
> Sorry for writing you directly, I think, that is more effective than
> finding interested persons in a maillist. I have very short question.

Hi, Dimitri, thanks for your feedback

The best way for this kind of things is to file a bug report of the
appropriate severity. This way the problem gets stored and assigned a bug
number. I am opening a new one on your behalf. You will receive another copy
of this mail with the bug number later, as well as Konstantin (whose mail
bounced yesterday) and squirrelmail maintainers.

> While looking at the debian module "dictionaries-common-0.98.10", I
> wound that squirrelmail spellchecker support is already there, but it
> supports only ispeel. I have played with a code a bit and added aspell
> engine support as well (see attached patch). The code might not be
> perfect, it still does not update the default language. But that is the
> minor thing still needs to be done...

I have been looking at the patch and seems that only changes in
update-dictcommon-aspell and DictionariesCommon::build_squirrelmail_support
are needed. There is no problem in calling aspell with -w or -T options, if
present. For compatibility with ispell aspell accepts them, and are silently
ignored. Also, aspell should work with -d, if the hash name is correctly put
in the dictionary info file. Otherwise is a bug in the dictionary package.

Also we are in the middle of a freeze previous to 'lenny' release, so do not
expect changes soon. Once 'lenny' is released, we will reconsider ispell
status, and we might even remove it from the archive.

> The items are also suffixed with engine used (so, for the users to see,
> when engine is invoked on each call). But it SquirrelSpell interface
> then is then difficult to localize. Just a matter of taste.

I do not use squirrelmail, so before including your changes I am
X-debbugs-cc'ing Debian squirrelmail maintainers. Since changes will show
up in squirrelmail, I will not add changes in the interface until approved
by them.

Your original patch follows, for archival purpose.

Regards,

-- 
Agustin

--- /usr/sbin/update-dictcommon-aspell.orig	2008-07-03 19:26:35.000000000 +0200
+++ /usr/sbin/update-dictcommon-aspell	2008-08-23 11:43:34.453341900 +0200
@@ -11,6 +11,7 @@
 updatedb ($class);
 build_emacsen_support ();
 build_jed_support ();
+build_squirrelmail_support ();
 
 system ("aspell-autobuildhash") == 0
     or die "Error running aspell-autobuildhash\n";
--- /usr/share/perl5/Debian/DictionariesCommon.pm.orig	2008-07-03 19:26:35.000000000 +0200
+++ /usr/share/perl5/Debian/DictionariesCommon.pm	2008-08-23 12:19:20.603448553 +0200
@@ -116,25 +116,35 @@
   my $T_option    = "";
   my $ispell_args = "";
 
-  $d_option = "-d $language->{'hash-name'}"
-      if exists $language->{'hash-name'};
-  $w_option = "-w $language->{'additionalchars'}"
-      if exists $language->{'additionalchars'};
+  if ($class eq 'ispell')
+  {
+    $d_option = "-d $language->{'hash-name'}"
+        if exists $language->{'hash-name'};
+    $w_option = "-w $language->{'additionalchars'}"
+        if exists $language->{'additionalchars'};
 
-  if ( exists $language->{'extended-character-mode'} ){
-    $T_option =  $language->{'extended-character-mode'};
-    $T_option =~ s/^~//; # Strip leading ~ from Extended-Character-Mode.
-    $T_option =  '-T ' . $T_option;
-  }
+    if ( exists $language->{'extended-character-mode'} ){
+      $T_option =  $language->{'extended-character-mode'};
+      $T_option =~ s/^~//; # Strip leading ~ from Extended-Character-Mode.
+      $T_option =  '-T ' . $T_option;
+    }
 
-  if ( exists $language->{'ispell-args'} ){
-    $ispell_args = $language->{'ispell-args'};
-    foreach ( split('\s+',$ispell_args) ) {
-      # No d_option if already in $ispell_args
-      $d_option = "" if /^\-d/;
+    if ( exists $language->{'ispell-args'} ){
+      $ispell_args = $language->{'ispell-args'};
+      foreach ( split('\s+',$ispell_args) ) {
+        # No d_option if already in $ispell_args
+        $d_option = "" if /^\-d/;
+      }
     }
+
+    return "$d_option $w_option $T_option $ispell_args";
   }
-  return "$d_option $w_option $T_option $ispell_args";
+  elsif ($class eq 'aspell')
+  {
+    return "-l $language->{'hash-name'}";
+  }
+
+  return '';
 }
 
 # ------------------------------------------------------------------
@@ -438,25 +448,24 @@
 # Build support file for squirrelmail with a list of available
 # dictionaries and associated spellchecker calls, in php format.
 # ------------------------------------------------------------------
-  my $class        = "ispell";
-  my $dictionaries = loaddb ($class);
-  my $php          = "<?php\n";
+  my @classes      = ("aspell","ispell");
   my @dictlist     = ();
 
-  $php .= generate_comment ("### ");
-  $php .= "\$SQSPELL_APP = array (\n";
-  foreach ( keys %$dictionaries ){
-    next if m/.*[^a-z]tex[^a-z]/i;            # Discard tex variants
-    my $spellchecker_params =
-	&dc_get_spellchecker_params($class,$dictionaries->{$_});
-    push @dictlist, qq {  '$_' => 'ispell -a $spellchecker_params'};
+  foreach my $class (@classes)
+  {
+    my $dictionaries = loaddb ($class);
+  	print STDERR "Loading class $class = %{$dictionaries}\n";
+    foreach ( keys %$dictionaries ){
+      next if m/.*[^a-z]tex[^a-z]/i;            # Discard tex variants
+      my $spellchecker_params = &dc_get_spellchecker_params($class,$dictionaries->{$_});
+	  next if ! /^(\S+)\s+\((.+)\)$/;
+      push @dictlist, qq { '$2 ($class)' => '$class -a $spellchecker_params' };
+    }
   }
-  $php .= join(",\n", @dictlist);
-  $php .= "\n);\n";
 
   open (PHP, "> $cachedir/$squirrelmailsupport")
       or die "Cannot open SquirrelMail cache file";
-  print PHP $php;
+  print PHP "<?php\n" . generate_comment ("### ") . "\$SQSPELL_APP = array (\n" . join(",\n", @dictlist) . "\n);\n?>\n";
   close PHP;
 }
 

Reply via email to