• Is this the correct way to use it?:

    --------------------

    WPLanguageControl.LoadFromFile('D:\!CVS_ACR\base_d7\cdunits\corretor-ortografico.xml');

    FSpellControler := TWPSpellController.Create(self);
    FSpellControler.AddFromFile('D:\!CVS_ACR\cd\testes\dic-export\dicionario\dicionario-portugues+fala-final.DCT');
    FSpellControler.PersistencyMode := wpUseRegistry;
    FSpellControler.Active := TRUE;
    FSpellControler.LoadSetup(false);

    wpEditorTexto.StartSpellCheck(wpStartSpellAsYouGo);

    --------------------

    It doesn't use my dictionary and also doesn't change labels in the Configure Dialog. "corretor-ortografico.xml" is a translated file to Brazilian Portuguese.

    Thank you.

    Antonio

    • Offizieller Beitrag

    Hi,

    I think "WPLanguageControl1.AutoLoadStrings := true;" is missing.

    this is some code to fill and show a popup menu with all available languages. It will also translate the language in the spell options.

    You will also need to select the language.

    SpellController.CurrentLanguage := ...
    For Portugese You can use 1046 (the id) or 2070 (the group) or You find the IDs in the file "WPLanguages.INC".

    Regards,
    Julian

  • Julian,

    Couldn't make it work. I'm trying to switch do spanish with your xml file, but I allways get an english dialog, look:

    WPLanguageControl.LoadFromFile('D:\spellxml.xml');
    WPLanguageControl.GlobalLanguage := 'ES';
    WPLanguageControl.AutoLoadStrings := TRUE;

    What am I doing wrong?

    Thanks,

    Antonio

  • Julian,

    Now I'm able to compile it, thanks. But look at the behaviour here:

    1) Click on Localization button
    2) Select FR from popup-menu
    3) Left-click over "WPSpell" Word
    4) Shows a Popup-menu in English
    5) Click on "Configure"
    6) Shows a dialog in English
    7) Click in OK button
    8) Left-click over "WPSpell" Word
    9) Shows a Popup-menu in French (but "Configure" & "Languages" are still in English)
    10) Click on "Configure" button
    11) Shows a dialog in English, not in French

    Best regards,

    Antonio

    • Offizieller Beitrag

    Hi,

    You are right, I am sorry:

    1) the compiler symbol USEWPT_LANGCTRL must be defined
    2) the XML data included be thw wpspell setup must be merged in wplanguagecontrol
    3) the update procedure reads now:

    Code
    procedure TWPToolsSpellDemoEditor.DE1Click(Sender: TObject);
    begin
       WPLanguageControl1.GlobalLanguage := (Sender as TMenuItem).Caption;;
       WPLanguageControl1.AutoLoadStrings := true;
    
    
       WPSpell_LoadVCLStrings;
    end;

    I updated the ZIP accordingly and included the XML also there.

    Kind Regards,
    Julian

  • Julian,

    I've (re)downloaded https://www.wpcubed.com/ftp/wpspelldemo.zip.
    I'm working with this new version and also with the xml file included. So:

    *** 1) the compiler symbol USEWPT_LANGCTRL must be defined

    Changed WPSpell_INC.INC to

    {$DEFINE USEWPT_LANGCTRL} // Use WPTools Language Controller

    *** 2) the XML data included be thw wpspell setup must be merged in wplanguagecontrol

    By "merged in wplanguagecontrol" I understood to load it, right? So I wrote that:

    WPLanguageControl1.LoadFromFile('D:\lixo\spell\spellxml.xml'); /// xml included in wpspelldemo.zip
    --> Let's call it spellxml_1 by now

    But before that I just got the version you save in

    WPLanguageControl1.SaveToFile('c:\spellxml.xml');
    --> Let's call it spellxml_2 by now

    And I found some big differences:

    spellxml_2 size: 142k
    spellxml_1 size: 30k

    spellxml_2 has a big comment section and a correct translation for <BR>
    spellxml_1 has a section <BR> but everything is in English for that language

    *** 3) the update procedure reads now:

    I'm using source files included in the new zip file

    New behaviour:

    1) Click on Localization button
    2) Select FR from popup-menu
    3) Left-click over "WPSpell" Word
    *4) Shows a Popup-menu in FRENCH ***** SOLVED (before it was in English at the first try)
    5) Click on "Configure"
    *6) Shows a dialog in English ***** (no changes on that!)
    7) Click in OK button
    *8) Left-click over "WPSpell" Word ***** SOLVED (as said in the step 4)
    *9) Shows a Popup-menu in French (but "Configure" & "Languages" are still in English) ***** SOLVED (as said in the step 4)
    10) Click on "Configure" button
    *11) Shows a dialog in English, not in French ***** (Still showing in English)

    And if I try to switch to BR it doesn't change the Popup dialog to BR.
    Even if I try a WPLanguageControl1.LoadFromFile from spellxml_2, wich has a correct translation for BR.

    Best regards,

    Antonio

    • Offizieller Beitrag

    Hi,

    Zitat

    *** 2) the XML data included be thw wpspell setup must be merged in wplanguagecontrol

    By "merged in wplanguagecontrol" I understood to load it, right? So I wrote that:

    No, double click on TWPLanguageControl to open data.

    You see the existing XML data or load it.

    Now select File\Merge and select the other XML file.

    You can save the result in a combined, new XML to be used with LoadFromFile.

    Please veryfiy the WPSpell.XML if it contains your language.

    Julian

  • Julian,

    I think I'm almost there.
    Popup and Configuration dialog now shows in my language.

    The problem, here, was that BR (Brazilian Portuguese) was just partially translated.
    I've rewritten some odd translations, misspelled words in portuguese, and translated tags that were still in english.

    I've sent you, by e-mail, my new BR branch.

    In the dialog, I'm still having a very small issue.
    The button Enable/Disable has 3 different captions:

    1) "Enable/Disable": When you click in the language root name (English-General)
    2) "Enable" or "Disable": When you click in the dictionary name (English US)
    3) "Enable" or "Disable": After clicking this button

    In this third case caption gets back to English. I think it may be using a third, different and absent xml tag.

    And I have a question, How do I remove, programatically, all languages and add just the one I need to have there?

    SpellController.ClearAll;

    and

    SpellController.AddFromFile('D:\!CVS_ACR\cd\testes\dic-export\dicionario\dicionario-portugues+fala-final.DCT');

    Doesn't work for me, even setting:

    SpellController.PersistencyMode := wpNoPersistency;

    It keeps recording somewhere my dictionaries.

    But it works when I remove or add a language within dialog.

    Thank you.

    Best regards,

    Antonio

    • Offizieller Beitrag

    Hi,

    sorry, beeing in an internet cafe I cannot debug this right now.

    >>And I have a question, How do I remove, programatically, all languages and add just the one I need to have there?


    The TWPLanguiage Controller inherits of the TWPXMLTree - see wpxmlint for more info. There are methods to locate a branch in the XML and delete them.

    Julian

  • About

    Zitat von wpsupport


    The TWPLanguiage Controller inherits of the TWPXMLTree - see wpxmlint for more info. There are methods to locate a branch in the XML and delete them.

    Sorry, Julian, my mistake. I want to remove all dictionaries and add my own, not languages! In every computer It starts with an english dictionary, I want it to start with mine.

    Thank you,

    Antonio

  • Julian,

    Still wating for you answer, I have an observation:

    I've had to change WPLanguages.INC from

    (name:'Portuguese-Brazil';id:1046;groupid:2070),
    (name:'Portuguese-Iberian';id:2070;groupid:2070),

    To

    (name:'Portuguese-Brazil';id:1046;groupid:1046),
    (name:'Portuguese-Iberian';id:2070;groupid:2070),

    Because when selecting Portuguese-Brazil in WPSpell Compiler the dictionary was appearing as Portuguese-Iberian in the application.
    This change solved it, but I don't know if it's right.

    Best regards,

    Antonio

  • Julian,

    I really need your help on these subjects.

    And, after all tests made with your project test, when I copied everything to my own project, configuration dialog shows up in english, not in portuguese. I'm trying to understand it here.

    I need your help with deleting dictionaries and adding my own without user intervention in the dialog.

    Thank you in advance,

    Antonio