use of org.obiba.core.translator.Translator in project mica2 by obiba.
the class SetsAggregationMetaDataHelper method getSetIds.
public Map<String, LocalizedMetaData> getSetIds() {
List<String> locales = micaConfigService.getLocales();
Map<String, Translator> translators = locales.stream().collect(Collectors.toMap(Function.identity(), locale -> JsonTranslator.buildSafeTranslator(() -> micaConfigService.getTranslations(locale, false))));
return getDocumentSetService().getAll().stream().collect(Collectors.toMap(DocumentSet::getId, set -> {
LocalizedString title = new LocalizedString();
locales.forEach(locale -> {
String setName = Strings.isNullOrEmpty(set.getName()) ? translators.get(locale).translate("sets.cart.title") : getDocumentSetName(set);
title.forLanguageTag(locale, setName);
});
return new LocalizedMetaData(title, new LocalizedString(), set.getType());
}));
}
Aggregations