Question

I have a listbox populated form a database table. I want to add a last item called "Go back" and I add it from the source code in this way:

lbDGroup.Items.Add('GO BACK');

I have a TLang component with the "GO BACK" string translated into another languages, but this item it's not transalted (it always shows "GO BACK").

How can I set it to be translated with TLang (all components added from design and all showmessages are shown correctly translated).

Thank's

Was it helpful?

Solution

You can get the current translated text programmatically of your GO BACK Source :

var
  dGOBACK: string;
begin
  dGOBACK := Lang1.LangStr[Lang1.Lang].Values['GO BACK'];
  lbDGroup.Items.Add(dGOBACK);
end;

OTHER TIPS

easier:

uses
  FMX.Types;

begin
  lbDGroup.Items.Add(Translate('GO BACK'));
end;

on Delphi FMX XE6 and above

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top