On Wed, Sep 03, 2008 at 10:09:34PM +0200, Thijs Kinkhorst wrote:
> On Tuesday 26 August 2008 22:38, Agustin Martin wrote:
> > I have been playing a bit with your patch. Please find attached a patch
> > explaining how are things now in my sandbox. Did not apply changes
> > related to -w and -T and also did some other minor changes.
> >
> > Thijs, what do you think about the proposed SquirrelSpell interface?
> 
> Sorry for not getting back to this earlier. Yes, this looks just fine and 
> seems to fit the current interface we have.

Hi, Thijs. 

Thanks for looking into this. Actualy there is no hurry, this kind of
changes will not make its way into lenny anyway, so we have time.

I was playing a bit more on this and I will probably upload something like
in (mostly untested) attached patch.

This way dictionaries info entries can have an explicit squirrelmail entry.
If not present, name is selected as proposed by Dmitry. If present and 'no'
that entry is ignored for squirrelmail. Otherwise its value is used as
language name for squirrelmail.

-- 
Agustin
diff --git a/scripts/Debian/DictionariesCommon.pm.in b/scripts/Debian/DictionariesCommon.pm.in
index 7fd7feb..3d9a4b6 100644
--- a/scripts/Debian/DictionariesCommon.pm.in
+++ b/scripts/Debian/DictionariesCommon.pm.in
@@ -438,20 +438,33 @@ sub build_squirrelmail_support {
 # 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 @classes      = ("aspell","ispell");
   my $php          = "<?php\n";
   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);
+    foreach ( keys %$dictionaries ){
+      next if m/.*[^a-z]tex[^a-z]/i;            # Discard tex variants
+      my $lang = $dictionaries->{$_};
+      my $squirrelname;
+      if ( defined $lang->{"squirrelmail"} ){
+	next if ( lc($lang->{"squirrelmail"}) eq "no" );
+	$squirrelname = $lang->{"squirrelmail"};
+      } else {
+	next unless m/^(\S+)\s+\((.+)\)$/;
+	$squirrelname = $2;
+      }
+      my $spellchecker_params =
+	&dc_get_spellchecker_params($class,$lang);
+      push @dictlist, qq {  '$squirrelname ($class)' => '$class -a $spellchecker_params'};
+    }
   }
-  $php .= join(",\n", @dictlist);
+
+  $php .= join(",\n", sort @dictlist);
   $php .= "\n);\n";
 
   open (PHP, "> $cachedir/$squirrelmailsupport")
diff --git a/scripts/system/update-dictcommon.in b/scripts/system/update-dictcommon.in
index 998e3ae..a029e03 100644
--- a/scripts/system/update-dictcommon.in
+++ b/scripts/system/update-dictcommon.in
@@ -11,6 +11,7 @@ my %locales    = ();
 updatedb ($class);
 build_emacsen_support ();
 build_jed_support ();
+build_squirrelmail_support ();
 
 system ("aspell-autobuildhash") == 0
     or die "Error running aspell-autobuildhash\n";

Reply via email to