• Gnu Gettext for Delphi and Woll2Woll

    We use GNU Gettext for translation in our Delphi 6 application. We also use the Woll2Woll data-aware components. In our forms we add the following to the OnCreate event:

    TranslateComponent( Self );

    We also have set up the typical ignores but we still had a problem with the Woll2Wol TwwDBComboBox that was not being populated properly and we could not set it getting the error: “True is not a valid Boolean value”. Turns out that the resourcestrings in DBConsts for the ‘True’ and ‘False’ values had been translated but the ‘Items’ property of the TwwDBComboBox that mapped ‘Yes’ to ‘True’ wasn’t being translated because the string was ‘Yes’#9’True’.

    I’ve added the following function to translate the items in the wwDBComboBox so that they map correctly:

      Procedure: Translate_wwDBCustomComboBox
      Author:    bvonfintel
      DateTime:  2013.09.12
      Arguments: const AComponent: TwwDBCustomComboBox
      Result:    None
    procedure Translate_wwDBCustomComboBox( const AComponent: TwwDBCustomComboBox );
      LIndex      : Integer;
      LTokenIndex : Integer;
      LToken1     : string;
      LToken2     : string;
      for LIndex := 0 to AComponent.Items.Count - 1 do begin
        LTokenIndex := 1;
        LToken1     := _( strGetToken( AComponent.Items[LIndex], #9, LTokenIndex ) );
        LToken2     := _( strGetToken( AComponent.Items[LIndex], #9, LTokenIndex ) );
        AComponent.Items[LIndex] := LToken1 + #9 + LToken2;

Leave a comment

If you want to share your opinion, leave a comment.

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> 

This site uses Akismet to reduce spam. Learn how your comment data is processed.