We have the application in delphi and now we are implementing language translation feature. We added the code in core to translate the strings which are declared in ResourceString. It is working fine but strings which is declared in Array not translated. Example
resourcestring
Error_Text = 'Invalid Value';
This is Working fine.
Const
ERROR_TYPE : Array[0..2] of String = ('Invalid Name', 'Invalid Age', 'Invalid Address');
How do i add these array values into resourcestring?
I think you can't directly have an array of resourcestring
. I'd try a function instead, something like:
resourcestring
ERROR_TYPE0 = 'Invalid Name';
ERROR_TYPE1 = 'Invalid Age';
ERROR_TYPE2 = 'Invalid Address';
type
TMyIndexType = 0..2;
function ERROR_TYPE(AIndex: TMyIndexType): string;
begin
case AIndex of
0: Result := ERROR_TYPE0;
1: Result := ERROR_TYPE1;
2: Result := ERROR_TYPE2;
else
// appropriate error handling
end;
end;