This article covers a Bloomreach Experience Manager version 12. There's an updated version available that covers our most recent release.

Make a Channel's Default Resource Bundle IDs Configurable in the Channel Manager

This feature is available since Hippo CMS 12.1.0

Introduction

Goal

Enable users the manage a channel's resource bundle IDs through the Channel Settings dialog in the Channel Manager.

Background

Hippo CMS's delivery tier supports localization through resource bundles. A default resource bundle ID (or multiple IDs) can be specified at in the delivery tier configuration at virtual host group, virtual host, or mount level. In addition, developers can define the default resource bundle IDs as a channel parameter in their implementation project, to enable end-users to change the parameter in the Channel Manager through a channel's Settings dialog. The channel parameter can be annotated with UI directives as usual.

This page explains how to define the default resource bundle IDs as a channel parameter.

Define Default Resource Bundle IDs as Channel Parameter

Define a ChannelInfo interface as explained in Define a Channel's Configuration Parameters.

Add a method getDefaultResourceBundleIds to the interface and annotate it with @Parameter with name hst:defaultresourcebundleid:

package org.example.channels;

import org.hippoecm.hst.configuration.channel.ChannelInfo;
import org.hippoecm.hst.core.parameters.FieldGroup;
import org.hippoecm.hst.core.parameters.FieldGroupList;
import org.hippoecm.hst.core.parameters.Parameter;

@FieldGroupList({
    @FieldGroup(
            titleKey = "fields.channel",
            value = { "hst:defaultresourcebundleid" }
    )
})
public interface WebsiteInfo extends ChannelInfo {

    @Parameter(
            name = "hst:defaultresourcebundleid", 
            required = false, 
            defaultValue="org.example.labels.Messages")
    String getDefaultResourceBundleIds();
    
}

Add localized UI labels for the interface at /hippo:configuration/hippo:translations/hippo:hst/channelparameters:

definitions:
  config:
    /hippo:configuration/hippo:translations/hippo:hst/channelparameters:
      jcr:primaryType: hipposys:resourcebundles
      /org:
        jcr:primaryType: hipposys:resourcebundles
        /example:
          jcr:primaryType: hipposys:resourcebundles
          /channels:
            jcr:primaryType: hipposys:resourcebundles
            /WebsiteInfo:
              jcr:primaryType: hipposys:resourcebundles
              /en:
                jcr:primaryType: hipposys:resourcebundle
                fields.channel: Channel Settings
                hst:defaultresourcebundleid: Default Resource Bundle IDs

The default resource bundle ID can then be configured in a channel's Settings dialog. Multiple resource bundle IDs can be specified as comma-separated.

 

Did you find this page helpful?
How could this documentation serve you better?
On this page
    Did you find this page helpful?
    How could this documentation serve you better?