How to translate string arrays

All announcements, questions and issues related to the TsiLang Components Suite.
Post Reply
StefanP
Posts: 8
Joined: Mon Jul 18, 2005 7:45 am

How to translate string arrays

Post by StefanP »

I have code like the following in a standalone .pas file (not a form).

Code: Select all

const
  // Filters for data events
  DataTextFilters: array[0..2] of string = (
    'equals',
    'starts with',
    'contains'
  );
These string are not found when I open the TsiLang expert and use

"File->Const->Without form..."

Simple string constants are found and can be translated.

What should I do?

Regards
StefanP
isiticov
Site Admin
Posts: 2383
Joined: Thu Nov 21, 2002 3:17 pm

Post by isiticov »

Best regards,
Igor Siticov.
zeras
Posts: 10
Joined: Sun Feb 18, 2018 10:23 am

Re: How to translate string arrays

Post by zeras »

I have same problem.

If I put like your instruction all to "const" section, I will get error message E2036, that a variable is needed.
Is there another way to translate string arrays like

[code]
{ //wird nicht übersetzt
TxtZnTyl : array[TmpZnZyl] of String = ( //01.05.18 vorher war AnsiString
'EFZ',
'M1',
'M2',
'M3',
'M4',
'M5',
'M6',
'D1',
'D2',
'D3'
);
[/code]
isiticov
Site Admin
Posts: 2383
Joined: Thu Nov 21, 2002 3:17 pm

Re: How to translate string arrays

Post by isiticov »

Hello,

As described here http://www.tsilang.com/delphiglobalizat ... aq.html#11 you would need just to modify a little your code like the following:

Code: Select all

var
	sEFZ: string = 'EFZ';
	sM1: string = 'M1';
	sM2: string = 'M2';
	sM3: string = 'M3';
	sM4: string = 'M4';
	sM5: string = 'M5';
	sM6: string = 'M6';
	sD1: string = 'D1';
	sD2: string = 'D2';
	sD3: string = 'D3';
	
const
TxtZnTyl : array[TmpZnZyl] of PString = ( //01.05.18 vorher war AnsiString
@sEFZ,
@sM1,
@sM2,
@sM3,
@sM4,
@sM5,
@sM6,
@sD1,
@sD2,
@sD3
);
Translate the strings above with TsiLang Expert and use the array elements like TxtZnTyl[0]^ instead of just TxtZnTyl[0].
Best regards,
Igor Siticov.
Post Reply