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

How to translate the string which is declared in Array in delphi?

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

resourcestring
 Error_Text = 'Invalid Value'; 

工作正常。

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

如何将这些数组值添加到资源字符串中?

我认为你不能直接拥有 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;