use of com.evolveum.midpoint.common.LocalizationService in project midpoint by Evolveum.
the class WebModelServiceUtils method translateMessage.
public static String translateMessage(OperationResult result, ModelServiceLocator page) {
LocalizationService service = page.getLocalizationService();
Locale locale = page.getLocale();
return service.translate(result.getUserFriendlyMessage(), locale);
}
use of com.evolveum.midpoint.common.LocalizationService in project midpoint by Evolveum.
the class OperationResultPanel method createMessage.
private Label createMessage() {
Label message = new Label(ID_MESSAGE_LABEL, (IModel<String>) () -> {
OpResult result = OperationResultPanel.this.getModel().getObject();
PageBase page = getPageBase();
String msg = null;
if (result.getUserFriendlyMessage() != null) {
// TODO: unify with WebModelServiceUtil.translateMessage()
LocalizationService service = page.getLocalizationService();
Locale locale = page.getSession().getLocale();
msg = service.translate(result.getUserFriendlyMessage(), locale);
}
if (StringUtils.isNotBlank(msg)) {
return msg;
}
msg = result.getMessage();
if (StringUtils.isNotBlank(msg)) {
return msg;
}
String resourceKey = OPERATION_RESOURCE_KEY_PREFIX + result.getOperation();
return page.getString(resourceKey, null, result.getOperation());
});
message.setOutputMarkupId(true);
return message;
}
Aggregations