* Rafael Laboissiere <[EMAIL PROTECTED]> [2007-01-27 00:42]: > One possible solution is to introduce squirrelspell support into > dictionaries-common. [snip]
Okay, I gave it a try. AgustÃn, you will find below a patch to the current CVS sources that introduce SquirrelMail support in dictionaries-common. The idea is to generate a PHP file (/sid/var/cache/dictionaries-common/sqspell.php) that can be sourced during SquirrelMail initialization. The file currently generated in my system is attached below. You will notice that the generated PHP hash array is like this: $SQSPELL_APP = array ( 'portugues brasileiro (Brazilian Portuguese)' => 'ispell -d brasileiro -a', 'francais Hydro-Quebec (French Hydro-Quebec)' => 'ispell -d francais -a', 'american (American English)' => 'ispell -d american -a' ); This is different from the current implementation in the squirrelmail package, in which the hash keys are just the part inside parentheses. I think that using the whole "language name" is better, since it has also the name in the native language, not only in English. I do not know much PHP, but the code in sqspell_config.php could be changed like this: ########################################################################### # Debian: if dictionaries-common >= 2.?? is available, detect the # installed dictionaries automatically. if ( is_readable ( '/var/cache/dictionaries-common/sqspell.php' ) ) { require_once ( '/var/cache/dictionaries-common/sqspell.php' ); } else { $SQSPELL_APP = array('English' => 'ispell -a', 'Spanish' => 'ispell -d spanish -a'); } # Debian: if dictionaries-common >= 2.?? is available, detect the # default dictionary automatically. if ( is_readable ( '/etc/dictionaries-common/ispell-default' ) ) { $dictdefault = file ( '/etc/dictionaries-common/ispell-default' ); $SQSPELL_APP_DEFAULT = $dictdefault[0]; } else { $SQSPELL_APP_DEFAULT = 'English'; } ########################################################################### -- Rafael
Index: scripts/Debian/DictionariesCommon.pm.in =================================================================== RCS file: /cvsroot/dict-common/dictionaries-common/scripts/Debian/DictionariesCommon.pm.in,v retrieving revision 1.30 diff -u -r1.30 DictionariesCommon.pm.in --- scripts/Debian/DictionariesCommon.pm.in 14 Feb 2006 12:46:33 -0000 1.30 +++ scripts/Debian/DictionariesCommon.pm.in 31 Jan 2007 13:02:34 -0000 @@ -9,6 +9,7 @@ getlibdir getsysdefault setsysdefault getuserdefault setuserdefault build_emacsen_support build_jed_support + build_squirrelmail_support build_pspell_support); # Import :all to get everything. our %EXPORT_TAGS = (all => [EMAIL PROTECTED]); @@ -20,6 +21,7 @@ my $userdefault = "$ENV{HOME}/.$ispelldefault"; my $emacsensupport = "@EMACSENSUPPORT@"; my $jedsupport = "jed-ispell-dicts.sl"; +my $squirrelmailsupport = "sqspell.php"; sub getlibdir { my $class = shift; @@ -347,6 +349,24 @@ close SLANG; } +sub build_squirrelmail_support { + + my $dictionaries = loaddb ("ispell"); + my $php = generate_comment ("### "); + + $php .= qq {<?php\n\$SQSPELL_APP = array (\n } + . join (",\n ", map { + my $hashname = $dictionaries->{$_}->{"hash-name"}; + qq {'$_' => 'ispell -d $hashname -a'}; + } keys %$dictionaries) + . qq {\n);\n?>\n}; + + open (PHP, "> $cachedir/$squirrelmailsupport") + or die "Cannot open SquirrelMail cache file"; + print PHP $php; + close PHP; +} + # Ensure we evaluate to true. 1; Index: scripts/system/update-default.in =================================================================== RCS file: /cvsroot/dict-common/dictionaries-common/scripts/system/update-default.in,v retrieving revision 1.35 diff -u -r1.35 update-default.in --- scripts/system/update-default.in 25 Aug 2005 16:29:29 -0000 1.35 +++ scripts/system/update-default.in 31 Jan 2007 13:02:34 -0000 @@ -133,6 +133,7 @@ #[W: (nothing to do for wordlists):][I: Ispell emacsen + jed support build_emacsen_support (); build_jed_support (); + build_squirrelmail_support (); system ("ispell-autobuildhash") == 0 or die "Error running ispell-autobuildhash\n"; # End of specific ispell support :] @@ -167,7 +168,7 @@ updates the system-wide setting F</etc/dictionaries-common/ispell-default>.:I] If option B<--rebuild> is given, rebuilds the F</var/cache/dictionaries-common/[I:ispell:][W:wordlist:].db> [I: -and the emacsen and jed support (to be put in +and the emacsen, jed, and SquirrelMail support (to be put in F</var/cache/dictionaries-common/>):I] from the files in F</var/lib/dictionaries-common/[I:ispell:][W:wordlist:]>
sqspell.php
Description: application/httpd-php