Ver Mensaje Individual
  #9  
Antiguo 25-04-2007
Avatar de dec
dec dec is offline
Moderador
 
Registrado: dic 2004
Ubicación: Alcobendas, Madrid, España
Posts: 13.141
Reputación: 36
dec Tiene un aura espectaculardec Tiene un aura espectacular
Hola,

De la ayuda de Delphi:

Cita:
Empezado por resourcestring
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';
SomeResourceString = SomeTrueConstant;
Aunque he de reconocer que un servidor utiliza los "resourcestring" un poco como "constantes de tipo string"... sin más. Es decir, no mirando si estos se almacenan como recursos, si pueden cambiarse sin necesidad de compilar la aplicación, etc.

Empero, algunas herramientas, como pueda ser DxGetText dan un tratamiento "especial" a los "resourcestring". Por ejemplo DxGetText puede "parsear" un archivo ".pas" y "tomar" las cadenas "resourcestring" automáticamente.

En todo caso, utilizados como constantes, los "resourcestring" ofrecen todo lo bueno de estas, según mi opinión. Personalmente, no me gusta mezclar las cadenas con el código fuente, y de ahí que use con profusión "resourcestring". ¿Que por qué no uso constantes directamente? No sé... no creo que tenga una respuesta muy lógica para esto.
__________________
David Esperalta
www.decsoftutils.com

Última edición por dec fecha: 25-04-2007 a las 18:05:32.
Responder Con Cita