OFBiz "labels" are the mechanism used to handle the locale-sensitive translation of many HTML form elements. While the underlying internationalization and localization support within OFBiz is implemented using Java ResourceBundles
, and is for the most part transparent to the application developer, the manual management of the translated objects that make up these resources is the subject of this section.
At last count, there are over 10,000 unique labels defined. Each of these labels has the potential of being translated into any supported language. To see at a glance all labels, and quickly edit a translation for a label, you may use the OFBiz Label Manager tool.
Note: for optimum performance when using the OFBiz Label Manager, make sure you set your JVM memory settings to the highest possible values supported by your hosting machine.
To get started with the WebTools Label Manager tool, either navigate to the WebTools main web page or go directly to the tool's URL located at:
https://localhost:8443/webtools/control/SearchLabels
If you have not already logged in, you will be prompted to log in. Enter the administrator's username and password. If these have not changed since initial system download, the administrative user's name is "admin" and the password is "ofbiz".
To edit labels, follow these steps:
OFBiz "labels" are part of the internationalization and localization support built-in to the OFBiz code base. "Labels" are the "key" portion of the key/value pair that make up the information needed to identify the translation of a particular text string. This key is used to look up translation maps in "label files". Any FreeMarker document and/or OFBiz widget may employ one or more "labels" to provide user session-based translations (called "localization").
Note: although the underlying support exists to translate OFBiz "labels" to any known language, only a few languages have complete translation maps in place.
Under the covers, OFBiz implements internationalization and localization using the Java ResourceBundle
class. "Labels" are stored in files, usually located in a Component's config
directory where the label's use originated. For example, within the Order
Component's config
directory, there are several "label" files: OrderEntryLabels.xml, OrderErrorUiLabels.xml
, and others. These files include one or more property "keys" that represent the "label" as it would appear in an HTML document.
As part of the construction of a web page using the Screen widget, any files containing locale labels are configured within the actions
portion of the screen's definition. You may see how this works by examining the contents of the actions
element within a screen's definition. If a declaration for a "property-map resource" is present, then one or more label files are available within the context for this web page.
For example, if, within a FreeMarker template, you have an HTML text string with FreeMarker markup as shown here:
${uiLabelMap.OrderWhereShallWeShipIt}
The uiLabelMap
is the name of the map that has been placed in the context, containing the translation of the OrderWhereShallWeShipIt
"label". To make all this work in real time, each user's session has an attribute indicating the locale to use for that session. OFBiz automatically takes the locale attribute, looks up the "label" in the specified map, in this case the uiLabelMap
, and returns the translated value.
You may edit "label" files by hand at any time if you know the location of the file in which the label is stored. Using the OFBiz Label Manager makes locating and editing OFBiz translation files (resource bundles) easy and painless.
If you wish to make available only certain language/locale translations for a particular instance of OFBiz, you may edit the following property file and control precisely which locales are available for user selection at runtime:
~framework/common/config/general.properties
Modify the locales.available
property as shown here:
# To only display the following locale specific labels: locales.available=fr,nl,zh,en,it,es,ja,de
3.12.136.119