On Sat, 21 Jun 2003, Christoph Hintermueller wrote:

> >>> Andrew Dunbar <[EMAIL PROTECTED]> 21.06.03 07.40 Uhr >>>
> 
> > To achieve this efficiently, we need to be able to ask
> > Aspell which languages it supports, this means an
> > enumeration API to return all supported language tags:
> > en, de, fr or en-US, en-GB, en-AU etc.
>
> As far as i have insight into aspells language mechanism there is no
> compiled in list of languages supported.

This is correct.  Nor are there any plans to.

> > We also need an API which will tell us whether a given
> > language is installed or not. Currently we can just try
> > to open each dictionary but we would prefer a less
> > expensive API which does not have to initialize an
> > entire spelling engine which is only going to be
> > destructed again.

Aspell 0.50 and better has a way to list the installed dictionaries. I 
attached the example file 'list-dicts.c' which is included in the 
examples/ directory.

-- 
http://kevin.atkinson.dhs.org
/* This file is part of The New Aspell
 * Copyright (C) 2002 by Kevin Atkinson under the GNU LGPL
 * license version 2.0 or 2.1.  You should have received a copy of the
 * LGPL license along with this library if you did not you can find it
 * at http://www.gnu.org/. 
*/

#include <stdio.h>
#include <string.h>
#include <stdlib.h>

#include "aspell.h"

int main(int argc, const char *argv[]) 
{
  AspellConfig * config;
  AspellDictInfoList * dlist;
  AspellDictInfoEnumeration * dels;
  const AspellDictInfo * entry;

  config = new_aspell_config();

  /* the returned pointer should _not_ need to be deleted */
  dlist = get_aspell_dict_info_list(config);

  /* config is no longer needed */
  delete_aspell_config(config);

  dels = aspell_dict_info_list_elements(dlist);

  printf("%-30s%-8s%-20s%-6s%-10s\n", "NAME", "CODE", "JARGON", "SIZE", "MODULE");
  while ( (entry = aspell_dict_info_enumeration_next(dels)) != 0) 
  {
    printf("%-30s%-8s%-20s%-6s%-10s\n",
           entry->name,
           entry->code, entry->jargon, 
           entry->size_str, entry->module->name);
  }

  delete_aspell_dict_info_enumeration(dels);

  return 0;
}

_______________________________________________
Aspell-devel mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/aspell-devel

Reply via email to