squirrelspell and aspell

Dmitry Katsubo <[email protected]>
Newsgroups gmane.mail.squirrelmail.devel
Message-ID <[email protected]>
Dear Squirrelmail developers!

I have found out that squirrelspell support is available in Debian
dictionaries-common package. So, one has only to benefit from it with
minor efforts. Please, the attached patch (sqspell_config.php.patch).

dictionaries-common.patch I've sent to "dictionaries-common" package
maintainer.

With best regards,

Dmitry

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/

-----
squirrelmail-devel mailing list
Posting guidelines: http://squirrelmail.org/postingguidelines
List address: [email protected]
List archives: http://news.gmane.org/gmane.mail.squirrelmail.devel
List info (subscribe/unsubscribe/change options): https://lists.sourceforge.net/lists/listinfo/squirrelmail-devel
sqspell_config.php.patch (text/plain, 957 B)
--- /usr/share/squirrelmail/plugins/squirrelspell/sqspell_config.php.orig	2007-05-10 00:00:00.000000000 +0200
+++ /usr/share/squirrelmail/plugins/squirrelspell/sqspell_config.php	2008-08-23 11:36:58.291679843 +0200
@@ -67,13 +67,8 @@
  
 # Debian: if dictionaries-common >= 2.50 is available, detect the
 # installed dictionaries automatically.
-if ( is_readable ( '/var/cache/dictionaries-common/ispell-dicts-list.txt' ) ) {
-    $dicts = file( '/var/cache/dictionaries-common/ispell-dicts-list.txt' );
-    $SQSPELL_APP = array();
-    foreach ($dicts as $dict) {
-        preg_match('/(\S+)\s+\((.+)\)/', $dict, $dparts);
-        $SQSPELL_APP[$dparts[2]] = 'ispell -d ' . $dparts[1] . ' -a';
-    }
+if ( is_readable ( '/var/cache/dictionaries-common/sqspell.php' ) ) {
+    include_once('/var/cache/dictionaries-common/sqspell.php');
 } else {
     $SQSPELL_APP = array('English' => 'ispell -a',
                  'Spanish' => 'ispell -d spanish -a');
dictionaries-common.patch (text/plain, 3.7 KB)
--- /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;
 }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.