4D v13.4

Resources

Home

 
4D v13.4
Resources

Resources  


 

As announced with the release of 4D v11 (see section below), mechanisms based on the use of resources files are obsolete. Beginning with 4D v13, commands in the "Resources" theme used to write in resources files are disabled and no longer work. Only 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 new 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). Two commands of the "Resources" theme can be used to take advantage of this architecture (see the Get indexed string and STRING LIST TO ARRAY commands).

 
PROPERTIES 

Product: 4D
Theme: Resources

 
SEE ALSO 

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