aspell-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Aspell-user] How to change Language during run-time


From: Nikunj Manocha
Subject: [Aspell-user] How to change Language during run-time
Date: Mon, 6 Jun 2005 17:02:21 -0400

Hi All,

  Am calling the Aspell Library through my Application. I start Aspell in Default English Language Dictionary and (as per User's interaction) I wish to change to the Spanish Dictionary (dynamically). I am unable to do this. I am appending the code I am using to do this. What am I doing wrong?

           AspellCanHaveError * ret;
        AspellSpeller *speller = (AspellSpeller *)handle;
        AspellConfig *config = aspell_speller_config(speller);
       
        const char * val2 = aspell_config_retrieve(config, "lang");
        //check_for_config_error(config);
        if (val2)
          printf("%s = \"%s\"\n", "lang", val2);

        AspellConfig * spell_config2 = aspell_config_clone(config);
        //delete_aspell_config(config);
        //delete_aspell_speller(speller);


       
         aspell_config_replace(spell_config2, key,value);
        ret = new_aspell_speller(spell_config2);

    
        if (aspell_error(ret) != 0) {
                   ThrowJASpellException(env, aspell_error_message(ret));
                   delete_aspell_can_have_error(ret);
                   return 0;
         }

        AspellSpeller *speller2 = to_aspell_speller(ret);
        const char * val = aspell_config_retrieve(spell_config2, "lang");
        //check_for_config_error(config);
        if (val)
          printf("%s = \"%s\"\n", "lang", val);

        AspellConfig *config2 = aspell_speller_config(speller2);
        const char * val3 = aspell_config_retrieve(config2, "lang");
        //check_for_config_error(config);
        if (val3)
          printf("%s = \"%s\"\n", "lang", val3);

        return (jint)speller2;

The above prints out :

lang = "en"
lang = "es"
lang = "en"

Why so? Someone please help. I am new to Aspell (as well as C programming).

Note: I am calling the Aspell C API using JNI calls from Java.

Any help will be appreciated. Thanks.


Best Regards,
Nikunj Manocha

www.plateau.com
703-292-0316


reply via email to

[Prev in Thread] Current Thread [Next in Thread]