4D v16.3

Resources

Home

 
4D v16.3
Resources

Resources  


 

As announced with the release of 4D v11 (see section below), mechanisms based on the use of resources files are obsolete. Commands in the "Resources" theme used to write in resources files must no longer be used; they will be removed from future versions of 4D. Commands used to read resources are maintained for compatibility.

The management of resources has been modified in 4D beginning with version 11. In conformity with the directions specified by Apple and implemented in the most recent Mac OS versions, the concept of resources in the strictest sense (see definition below) is now obsolete and will be abandoned progressively. New mechanisms have been implemented to support the needs that were previously met by resources: XLIFF files for the translation of character strings, .png picture files, etc. In fact, resource files will be replaced in favor of standard type files. 4D supports this evolution and, beginning with version 11, provides new tools for the management of database translations, while maintaining compatibility with existing systems.

To maintain compatibility and in order to permit the progressive adaptation of existing applications, the former resource mechanisms will containue to work in 4D v11, with just a few notable differences:

  • When present, resource files are still supported by 4D and the principle of the“string of resource files” (successive opening of several resource files) remains valid. The “string of resource files” includes more particularly the .rsr or .4dr files of converted databases (opened automatically) and the custom resource files opened using the commands of this theme.
  • However, for reasons related to the evolution of the internal architecture, it is no longer possible to access the resources of the 4D application nor those of the system directly, whether via the commands of this theme or using dynamic references. Certain developers make use of 4D internal resources for their interfaces (for example, resources containing the names of the months or those of the language commands). This practice is now strictly forbidden. In most cases, it is possible to use other means instead of 4D internal resources (constants, language commands, and so on). In order to limit the impact of this modification on existing databases, a substitution system has been implemented, based on the externalization of the resources that are most frequently used. It is nevertheless strongly recommended to change converted databases and to remove any calls to 4D internal resources they may contain.
  • Starting with version 11, databases created by 4D will no longer contain .RSR (structure resources) and .4DR (data resources) files by default.

In 4D v11, the notion of “resources” must be understood in the broader sense as “files that are necessary for the translation of application interfaces.” The current architecture of resources is based on a folder, named Resources, that must be located next to the database structure file (.4db or .4dc). In this folder, you need to put all the files that are necessary for the translation or customizing of the application interfaces (picture files, text files, XLIFF files, and so on).
It can also contain any “former generation” resource files of the database (.rsr files). Be careful, these files are not automatically included in the string of resources; they must be opened using standard 4D resource handling commands. 4D uses automatic mechanisms when working with the contents of this folder, in particular for the management of XLIFF files (this point is covered in the Design Reference manual). For compatibility reasons, the Get indexed string and STRING LIST TO ARRAY commands of the "Resources" theme can be used to take advantage of this architecture; however, it is now recommended to use the Get localized string command of the "String" theme.



See also 

_o_Get component resource ID
BLOB Commands
OS Resource Manager Errors (-196 -> -1)

 
PROPERTIES 

Product: 4D
Theme: Resources

 
HISTORY 

 
ARTICLE USAGE

4D Language Reference ( 4D v16)
4D Language Reference ( 4D v16.1)
4D Language Reference ( 4D v16.2)
4D Language Reference ( 4D v16.3)