0

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

4

2 回答 2

2

您可以通过编程方式获取您的 GO BACK Source 的当前翻译文本:

var
  dGOBACK: string;
begin
  dGOBACK := Lang1.LangStr[Lang1.Lang].Values['GO BACK'];
  lbDGroup.Items.Add(dGOBACK);
end;
于 2013-11-08T20:31:21.950 回答
1

更轻松:

uses
  FMX.Types;

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

在 Delphi FMX XE6 及以上

于 2015-01-13T11:16:16.527 回答