TWPLocalizationInterface & Builder C++ 6

  • Hello !

    I try to use the localization with Builder C++.

    In delphi, it is :

    // requires unit WPUtils and WPActnStr
    WPLangInterface := TWPLocalizationInterface.Create(WPLanguageControl1);
    WPLanguageControl1.GlobalLanguage := 'DE';
    WPLocalizeLoadForms := TRUE;
    WPTools_LoadVCLStrings;
    WPTools_LoadActionStrings;

    In C++, i translate like this :

    // requires unit WPUtils and WPActnStr
    WPLangInterface = new TWPLocalizationInterface(WPLanguageControl1); //WPTOOLS5
    WPLanguageControl1->GlobalLanguage = "DE";
    WPLocalizeLoadForms = TRUE; //WPTOOLS5
    WPTools_LoadVCLStrings(); //WPTOOLS5
    WPTools_LoadActionStrings(); //WPTOOLS5

    On the first line :
    WPLangInterface = new TWPLocalizationInterface(WPLanguageControl1);

    Construction
    [C++ Erreur] xxxxxx.cpp(28): E2285 Impossible de trouver une correspondance pour 'TWPLocalizationInterface::TWPLocalizationInterface(TWPLanguageControl *)'

    in english :

    Impossible to find this prototype 'TWPLocalizationInterface::TWPLocalizationInterface(TWPLanguageControl *)'

    Have you a solution or/and an example in C++ ?

    François
    :wink:

    • Offizieller Beitrag

    Hi,

    it used to work C++Builder 5.

    WPLangInterface := TWPLocalizationInterface.Create(WPLanguageControl1);

    calls up
    constructor Create(WPLocalizationInterface: IUnknown);

    this means it uses the COM interface implemented by

    TWPLanguageControl = class(TWPCustomXMLTree, IWPLocalizationInterface, IUnknown)

    I cannot say why this does not work.

    Hardcoding this in one of the pascal units in the initialization part (atr end of unit) helps, but is no real solution.


    Julian

  • Hmm!

    I use this code (BTW, in a DataModule's constructor):

    WPLanguageControl1->Active = true;
    WPLangInterface = new TWPLocalizationInterface( (IUnknown*)*WPLanguageControl1 );

    WPLng = "DE";
    LocStr = "/" + WPLanguageControl1->XMLParent + "/" + WPLng;
    if (WPLanguageControl1->Find( LocStr ) != NULL) {
    WPLanguageControl1->GlobalLanguage = WPLng;
    WPLocalizeLoadForms = true;
    WPTools_LoadVCLStrings();
    WPTools_LoadActionStrings();
    GlobalValueUnit = euCm;
    }

    Please check:
    1. WPLanguageControl1->Active = true ?
    2. To be sure, use 'true', not 'TRUE'.
    3. Is WPLanguageControl1's XML-Tree filled with the DE-translations?

    Kind regards,
    E. Hess