Only first resourcestring is translated

All announcements, questions and issues related to the TsiLang Components Suite.
Post Reply
martijn_brinkers
Posts: 1
Joined: Sat Sep 24, 2005 10:07 am

Only first resourcestring is translated

Post by martijn_brinkers »

I need to localize my application and I am experimenting with TsiLang. I use resource string quite often in my units and I notice that TsiLang only converts the first resourcestring occurrence. So for example with the following two procedures only the first string will be handled by TsLang automatically (using TsiLang expert const section):

Code: Select all

procedure XXX
resourcestring XXX="somestring"
begin
  ...
end

procedure YYY
resourcestring YYY="somestring"
begin
  ...
end
Another problem I have is that some code is added which seems not to work with (constant) resourcestring. Example

Code: Select all

procedure TIzemailMainFrm.UpdateStrings;
begin
  XXX := siLang1.GetTextOrDefault('strXXX');
end;
I can convert all resourcestrings to constants. But, I then need to use the {$J+} complier switch otherwise the const can not be set. Am I doing something wrong?

Regards

Martijn Brinkers
isiticov
Site Admin
Posts: 2385
Joined: Thu Nov 21, 2002 3:17 pm

Post by isiticov »

Const section translation is designed to translate the strings declared at the "top of the unit" (before the first begin occurence, this is why it found only first string in your case). After performing this you can just change Const to VAR or use {J+} directive.

The strings like in your project will need either code modification to move them from local procedures to the "top of the unit" or you can use Resource Strings Wizard and import them to TsiLang from compiled application. In such case no code modofication required and TsiLang will automatically handle resource strings during run-time.

Please let me know if this helps.
Best regards,
Igor Siticov.
Post Reply