Hi,
  I posted a while ago about problems I was having with aspell-0.50.3-16.
I didn't mention that it was Fedora.  This is where the problem might come
up.  Anyway, the new aspell prefers LANG and --lang and --jargon using
things like: en_GB.  The current php-4.3.4 as far as I can tell still
prefers the --language-tag, --spelling and --jargon.  I wrote this to fix
it for me.  Its probably fixed in later versions anyway:

./ext/pspell/php_pspell.h

45a46
> PHP_FUNCTION(pspell_config_replace_part);

./ext/pspell/pspell.c

71a72
>       PHP_FE(pspell_config_replace_part,              NULL)
857a859,884
> /* {{{ proto int pspell_config_replace_part(int conf, string confpart, string repl)
>   Replace part of the config */
> PHP_FUNCTION(pspell_config_replace_part)
> {
>     int type;
>     zval **sccin, **confpart, **repl;
>     int argc;
> 
>     PspellConfig *config;
>     
>     argc = ZEND_NUM_ARGS();
>     if (argc != 3 || zend_get_parameters_ex(argc,&sccin,&confpart,&repl) == FAILURE) 
> {
>         WRONG_PARAM_COUNT;
>     }
> 
>     convert_to_long_ex(sccin);
>     config = (PspellConfig *) zend_list_find(Z_LVAL_PP(sccin), &type);
>     if(!config){
>         php_error(E_WARNING, "%ld is not a PSPELL config index",Z_LVAL_PP(sccin));
>         RETURN_FALSE;
>     }
> 
>     pspell_config_replace(config, Z_STRVAL_PP(confpart), Z_STRVAL_PP(repl));
> }
> /* }}} */
> 

This is how I used it in my PHP:

    $pspell_config = pspell_config_create("en");

    pspell_config_replace_part($pspell_config, "lang", "en_GB");
    pspell_config_replace_part($pspell_config, "jargon", $dict);

    $this->pspell = pspell_new_config($pspell_config);

This allows me to use different dictionaries for different parts of my
work.

Hope its useful:

Owen.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to