Resource strings are stored as
resources and linked into the executable or library so that they can be
modified without recompiling the program. For more information, see Internationalization and localization and the topics
that follow it.
Resource strings are declared like
other true constants, except that the word const is replaced by resourcestring.
The expression to the right of the = symbol must be a constant expression and
must return a string value. For example,
resourcestring
CreateError = 'Cannot create file %s'; { for explanations of format specifiers,
}
OpenError = 'Cannot open file %s';
{ see 'Format strings' in the online Help }
LineTooLong = 'Line too long';
ProductName = 'Borland Rocks\000\000';
SomeResourceString = SomeTrueConstant;
The compiler automatically resolves naming conflicts among resource strings in different libraries.
资源串作为资源存储并连接到可执行程序或包中,从而使可执行程序或包可以被修改而不必重编译。更多信息见国际化和本地化以及跟随其后的主题。
资源串的声明与其他真实常量的声明相似,不同的是,需要用保留字resourcestring代替const。此外,声明中等号(=)右边的表达式必需是一个常量表达式并且必需返回一个串值。例如,
resourcestring
CreateError = 'Cannot create file %s'; { 用于格式化说明符的解释
}
OpenError = 'Cannot open file %s';
{ 见有关
'Format strings' 的联机帮助 }
LineTooLong = 'Line too long';
ProductName = 'Borland Rocks\000\000';
SomeResourceString = SomeTrueConstant;
编译器自动处理不同包中的命名冲突。