THIS IS A TEST INSTANCE. ALL YOUR CHANGES WILL BE LOST!!!!
...
The text will be translated into the user's locale.
Translating Text In Mini-Language
The process is similar in Mini-Language, but the syntax is slightly different:
Code Block | ||||
---|---|---|---|---|
| ||||
<property-to-field resource="CommonUiLabels" property="CommonAddNew" field="addNew"/>
<log level="info" message="${addNew}"/>
|
where resource is the name of the UI label file (extension optional) and field is the name of the variable that will contain the translated text.
Translating Text In Java
Translating text in Java is accomplished by using the org.ofbiz.base.UtilProperties
class. Here is an example:
Code Block | ||||
---|---|---|---|---|
| ||||
public static Map<String, Object> myJavaService(DispatchContext ctx, Map<String, ?> context) {
Locale locale = (Locale) context.get("locale");
try {
// Do something risky
} catch (Exception e) {
return ServiceUtil.returnError(UtilProperties.getMessage(MyUiLabels, "RiskyErrorMessage", locale));
}
...
}
|