use of org.talend.dataprep.i18n.MessagesBundle in project data-prep by Talend.
the class ExportFormatConversions method doWith.
@Override
public BeanConversionService doWith(BeanConversionService conversionService, String beanName, ApplicationContext applicationContext) {
final MessagesBundle messagesBundle = applicationContext.getBean(MessagesBundle.class);
conversionService.register(//
fromBean(ExportFormat.class).toBeans(//
ExportFormatMessage.class).using(ExportFormatMessage.class, (exportFormat, exportFormatMessage) -> {
final String code = "export." + exportFormat.getName() + ".display";
final String displayName = messagesBundle.getString(LocaleContextHolder.getLocale(), code);
exportFormatMessage.setId(exportFormat.getName());
exportFormatMessage.setName(displayName);
exportFormatMessage.setSupportSampling(exportFormat.supportSampling());
return exportFormatMessage;
}).build());
return conversionService;
}
Aggregations