This is a feature of JBuilder Professional and Enterprise.
The Resource wizard prepares your application or applet for translation. It moves hardcoded strings in your source code files to ResourceBundles
.
ResourceBundles
are specialized files that contain a collection of translatable strings. (They may also contain other types of data, though this is less common.) A unique resource key identifies each translatable string in the ResourceBundle.
The hardcoded string in your application is replaced by a reference to the ResourceBundle
and the resource key. This separation of application logic and translatable elements is called resourcing. These separate resource files are then sent to translators.
The Resource wizard supports the two standard forms of ResourceBundles: ListResourceBundle
and PropertyResourceBundle
.
PropertyResourceBundles
are text files with a .properties
extension, and are placed in the same location as the class files for the source code. ListResourceBundles
are provided as Java source files. Because they are implemented as Java source code, new and modified ListResourceBundles
need to be recompiled for deployment. With PropertyResourceBundles
, there is no need for recompilation when translations are modified or added to the application. ListResourceBundles
provide considerably better performance than PropertyResourceBundles.
To display this wizard,
Use this page to specify the name of your ResourceBundle
and whether the wizard creates the keys that identify the strings based on the string values or the component and property names.
Specify the name of the ResourceBundle you want your strings added to. If an existing ResourceBundle exists in your project, the wizard suggests that ResourceBundle. To create a new ResourceBundle, choose New.
Opens the Create ResourceBundle dialog box, which allows you to create a new resource bundle. You use this dialog box to specify whether the ResourceBundle
is a ListResourceBundle
or a PropertyResourceBundle.
Resources only the current source file.
Resources source files in the current package.
This is a feature of JBuilder Professional and Enterprise.
Use this step to choose whether the bundle key will be based on the text of the string, the property setting for which it is used, or sequentially.
Specifies that the Resource Strings wizard suggest a key based on the value of the hardcoded string. For example, if the string is "Click to continue", the suggested key might be "Click_to_continue". Selecting this option deselects the Generate Key From Component and Property Names option.
Specifies that the Resource Strings wizard suggest a key based on the component and property that the string was used to set. Here is an example:
continueButton.setLabel("Click to continue");
In this example, the suggested key might be "continueButton.Label".
Selecting this option deselects the Generate Key From String Value option.
Generates keys sequentially, using the prefix identifed in the Prefix String field.
The prefix to use when keys are generated sequentially.
This is a feature of JBuilder Professional and Enterprise.
Use this step to specify which strings the Resource wizard found in your code you want to resource.
The Resource wizard lists all the strings it finds in your code in a table that contains these named columns.
Resources the selected strings.
Un-resources the selected strings.
The name given by the wizard that identifies a particular string. You can edit this name if you want.
The string as it appears in your code.
There is a check box to the left of each row in the table. By default, it will be checked, meaning that the string will be resourced. If you don't want the string resourced, uncheck the check box for that row.
When you choose Finish, the wizard creates a ResourceBundle
file and adds it to your project.