Resources and 4D Insider: an Example

4D - Documentation   Français   English   German   4th Dimension 2004, Command Theme List   4th Dimension 2004, Command Alphabetical List   4th Dimension 2004, Constant Theme List   Back   Previous   Next

version 6.0


Resources are a very convenient way to deal with localization issues when developing and maintaining a 4D database in different languages for the international market.

Let's look at an example. The following figure shows the menu bar of a database in English:

The title and menu items of the File and Edit menus already refer to resources (they appear in italics), while the Examples menu, that is composed of the menu items Hierarchical Lists and Picture Menus, does not.

Using 4D Insider, it is possible to transform the literals of the menu bar into references to strings stored in STR# resources. Let's see how to perform this operation.

Note: 4D Insider is the 4D cross-reference, components and library management tool delivered with 4D Developer Edition.

1. Open the database using 4D Insider. The following figure shows the menu bar in the 4D Insider browser window:

2. At this point, the menu bar can be transformed to refer to a STR# resource. To do so, select Text to STR# from the 4D Insider Tools Menu:

The TEXT to STR# resource dialog box appears and you can enter the resource name and ID. For example, Examples Menu can be the resource name and 20000 the resource ID:

3. Click New then OK. The resource is created.

4. Select STR# in the pop-up menu of the browser window's main list:

5. Double-click the STR# 20000 list item. Its contents are displayed in the preview area.

Now that these strings are stored in a resource, it is possible to change their values without tampering with the logic of your database development.

6. To change the values, select Edit STR# from the 4D Insider Tools menu while the Examples Menu resource is selected in the main list of the browser window:

The STR# resource editing window appears:

7. Translate the strings to another language. In the following figure, the strings have been translated to French:

8. Once you have performed the translation, close the window. Click Yes in the confirm dialog box:

9. At this point, quit 4D Insider and reopen the database with 4th Dimension. The 4D Design environment Menu Bar editor now shows the menu bar with the references to the resources in French:

Refer to the 4D Insider documentation for more information about this process. In addition, for more information about using references to resources in menus bars as well as objects in your database forms, refer to the 4th Dimension Design Reference manual.

The 4D Resources commands enable you to use the resources created by 4D Insider. The following method uses the STRING LIST TO ARRAY command to load the STR# resource (created using 4D Insider) into an array:

In the Debugger window, you can see that the array is populated with the strings translated in 4D Insider:

See Also

Resources.


4D - Documentation   Français   English   German   4th Dimension 2004, Command Theme List   4th Dimension 2004, Command Alphabetical List   4th Dimension 2004, Constant Theme List   Back   Previous   Next