hello,
I want to get translation of a component at runtime (caption of a button for example) to assign it to a label.
How can i do it without duplicating translation on the label (because it is the same)?
I tested use: siLang.GetText('component.name') but did not work.
thnks & regards,
Javier Orellana
www.tmssoft.com
Get translation of a component at runtime
-
- Posts: 8
- Joined: Mon Sep 04, 2006 9:56 am
Hello,
GetText() works for user defined strings only.
You can use GetStringValue() value method:
Sample usage:
But I think more useful in your case would be to assign both label and button caption in code and later use TsiLang Expert to scan your source and make replacement (translation) for this hardcoded string.
GetText() works for user defined strings only.
You can use GetStringValue() value method:
Code: Select all
function GetStringValue(const AStrings: TStrings; AName: Tstring; ALang: Integer):
Tstring;
AStrings- properties translations list, like Captions, Hints...
AName- string identifier, 'Label1' in your case
ALang- translation language index to extract.
Code: Select all
Button1.Caption := siLang1.GetStringValue(siLang1.Captions, 'Label1', siLang1.ActiveLanguage);
Best regards,
Igor Siticov.
Igor Siticov.