如何翻译delphi中数组中声明的字符串?

如何翻译delphi中数组中声明的字符串?,delphi,delphi-xe2,pascal,delphi-xe7,Delphi,Delphi Xe2,Pascal,Delphi Xe7,我们有delphi中的应用程序,现在我们正在实现语言翻译功能。我们在core中添加了代码来翻译ResourceString中声明的字符串。它工作正常,但数组中声明的字符串未转换。 范例 这很好用 Const ERROR_TYPE : Array[0..2] of String = ('Invalid Name', 'Invalid Age', 'Invalid Address'); 如何将这些数组值添加到resourcestring中?我认为不能直接拥有resourcestring的数组。我

我们有delphi中的应用程序,现在我们正在实现语言翻译功能。我们在core中添加了代码来翻译ResourceString中声明的字符串。它工作正常,但数组中声明的字符串未转换。 范例

这很好用

Const
 ERROR_TYPE : Array[0..2] of String = ('Invalid Name', 'Invalid Age', 'Invalid Address');

如何将这些数组值添加到resourcestring中?

我认为不能直接拥有
resourcestring
的数组。我会尝试一个函数,比如:

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;
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;