use of org.eclipse.smarthome.core.thing.type.ChannelGroupTypeBuilder in project smarthome by eclipse.
the class ChannelGroupTypeI18nLocalizationService method createLocalizedChannelGroupType.
public ChannelGroupType createLocalizedChannelGroupType(Bundle bundle, ChannelGroupType channelGroupType, @Nullable Locale locale) {
ChannelGroupTypeUID channelGroupTypeUID = channelGroupType.getUID();
String defaultLabel = channelGroupType.getLabel();
String label = thingTypeI18nUtil.getChannelGroupLabel(bundle, channelGroupTypeUID, defaultLabel, locale);
String description = thingTypeI18nUtil.getChannelGroupDescription(bundle, channelGroupTypeUID, channelGroupType.getDescription(), locale);
List<ChannelDefinition> localizedChannelDefinitions = channelI18nUtil.createLocalizedChannelDefinitions(bundle, channelGroupType.getChannelDefinitions(), channelDefinition -> thingTypeI18nUtil.getChannelLabel(bundle, channelGroupTypeUID, channelDefinition, channelDefinition.getLabel(), locale), channelDefinition -> thingTypeI18nUtil.getChannelDescription(bundle, channelGroupTypeUID, channelDefinition, channelDefinition.getDescription(), locale), locale);
ChannelGroupTypeBuilder builder = ChannelGroupTypeBuilder.instance(channelGroupTypeUID, label == null ? defaultLabel : label).isAdvanced(channelGroupType.isAdvanced()).withCategory(channelGroupType.getCategory()).withChannelDefinitions(localizedChannelDefinitions);
if (description != null) {
builder.withDescription(description);
}
return builder.build();
}
Aggregations