Search in sources :

Example 1 with MessagesBundle

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;
}
Also used : ExportFormatMessage(org.talend.dataprep.format.export.ExportFormatMessage) MessagesBundle(org.talend.dataprep.i18n.MessagesBundle)

Aggregations

ExportFormatMessage (org.talend.dataprep.format.export.ExportFormatMessage)1 MessagesBundle (org.talend.dataprep.i18n.MessagesBundle)1