On Thu, Feb 01, 2007 at 10:23:28PM +0100, Rafael Laboissiere wrote:
> * Agustin Martin <[EMAIL PROTECTED]> [2007-02-01 11:06]:
> 
> > Thijs, did you try my last patch (using ispell-wrapper) to
> > plugins/squirrelspell/sqspell_config.php? If working I am more in favour of
> > something like that since it would require no changes in
> > dictionaries-common. 
> 
> I thought that Thijs was trying to avoid the extra call to a Perl script
> from PHP.  Anyway, I agree that a solution that does not require changes in
> dictionaries-common is better.

There should be very litle extra load due to ispell-wrapper. It finishes early
leaving the real ispell process running with the appropriate parameters.

Another reason for considering (at least temporarily) a squirrelmail only
fix is that, if etch stays delayed and the fix is extensively tested before
uploading, it has a chance of being accepted into etch, of course asking
debian-release before actually uploading.

However, I have noticed a problem in my original patch because it used the
original regexp and it would only match language entries where the
non-english part is a single word. I am attaching a patch with a different
regexp, tested in perl (again, nothing is tested in PHP). I have also
modified it to use as tag to be displayed the full language name, as in
your patch.

The only problem I see in the proposed change (apart from making sure it is
real PHP) is that if more than one ispell dict have the same english part in
the language field ispell-wrapper will complain. But I do not think that
is happening now and would be anyway better than what we currently have.

-- 
Agustin
diff -Naur squirrelmail-1.4.9a.thijs/plugins/squirrelspell/sqspell_config.php 
squirrelmail-1.4.9a/plugins/squirrelspell/sqspell_config.php
--- squirrelmail-1.4.9a.thijs/plugins/squirrelspell/sqspell_config.php  
2007-01-31 17:46:14.000000000 +0100
+++ squirrelmail-1.4.9a/plugins/squirrelspell/sqspell_config.php        
2007-02-06 13:32:31.000000000 +0100
@@ -27,21 +27,21 @@
  *                     'Spanish' => 'aspell -d spanish -a' );
  */
 
-# Debian: if dictionaries-common >= 2.50 is available, detect the
+# Debian: if dictionaries-common >= 0.22.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';
+        preg_match('/(.*[^\s]+)\s*\((.+)\)/', $dict, $dparts);
+        $SQSPELL_APP[$dict] = 'ispell-wrapper --language="' . $dparts[2] . '" 
-a';
     }
 } else {
     $SQSPELL_APP = array('English' => 'ispell -a',
                  'Spanish' => 'ispell -d spanish -a');
 }
 
-# Debian: if dictionaries-common >= 2.50 is available, detect the
+# Debian: if dictionaries-common >= 0.22.50 is available, detect the
 # default dictionary automatically.
 if ( is_readable ( '/etc/dictionaries-common/ispell-default' ) ) {
     $dictdefault = file ( '/etc/dictionaries-common/ispell-default' );

Reply via email to