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

Dynamic Resource Bundle Node Structure

Resource Bundle Documents in the Content Repository

Resource Bundle Documents can be created and managed in the CMS using the Resource Bundle Editor plugin. This plugin is installed by default when creating a project using the Maven archetype.

The content type of resource bundle documents is defined as follows:

[resourcebundle:resourcebundle] > hippo:document, hippostd:publishableSummary, hippostdpubwf:document orderable
- resourcebundle:id (string) mandatory
- resourcebundle:keys (string) multiple
- resourcebundle:messages (string) multiple
- * (string)
- * (string) multiple

Here's an explanation for each property:

 Property Definition  Type  Description  Example values
   resourcebundle:id  string

 The  basename of the resource bundle which this resource bundle document is defining.
 This property is used to determine the proper resource bundle by the basename configuration in the system, so this property value must be unique in all the resource bundle documents in the repository.

 org.example.app.Messages
   resourcebundle:keys string, multiple  Array of resource bundle keys.
 This property values are equivalent to all the property key names in a properties resource bundle file, for instance.
   Note: each item of this value array should map to each item of the value array of "resourcebundle:messages" property.
   { "greeting.one", "greeting.two" }
   resourcebundle:messages string, multiple  Array of resource bundle messages for the default locale.
 This property values are equivalent to all the property values in a properties resource bundle file, for instance.
   Note: each item of this value array should map to each item of the value array of "resourcebundle:keys" property.
   { "Hello!", "Hippo!" }
   * (string) string  This property exists for any potential extension points. For example, you might want to put some custom properties for your specific needs, for instance.    - "myproject:specialkey" = "special"
   * (string) multiple string, multiple

 This property exists to store localized resource bundle messages. For example, if you want to support the locales, "en_US", "fr" and "nl_NL" specifically, then you should add the following property:
 - "resourcebundle:messages_en_US"
 - "resourcebundle:messages_fr"
 - "resourcebundle:messages_nl_NL"

  And, you should add localized resource bundle messages for each locale in these properties.
  It's a convention to append the locale name after "resourcebundle:messages_" for each localized messages.
  Note: each item of this value array should map to each item of the value array of "resourcebundle:keys" property.

   Note: You can also add some custom properties having multiple values by this property definition, but you should avoid property names starting with "resourcebundle:messages_" in that case.

  - "resourcebundle:messages_en_US" = { "Hello!","Hippo!" }
 - "resourcebundle:messages_fr" = { "Bonjour!", "Hippo!" }
 - "resourcebundle:messages_nl_NL" = { "Hallo!", "Hippo!" }

 

Please note that you can add documents in any location by the  resourcebundle:resourcebundle content node type, but you should keep the  resourcebundle:id property unique throughout the repository because the  resourcebundle:id property value is used when looking up the resource bundle by the  basename.

Also, you can set the message keys and the default locale messages in  resourcebundle:keys and  resourcebundle:messages properties, and you have to add localized messages in a separated properties named in the pattern,  resourcebundle:message_${locale.name}, where  ${locale.name} must be replaced by the real locale name such as  en_USfrnl_NL, etc.

Each value item of  resourcebundle:keys property must match with each value item of  resourcebundle:messages and  resourcebundle:messages_* properties. Otherwise, the mismatch will be logged as errors without proceeding.

Here's an example resource bundle document contents. This is excerpt from https://code.onehippo.org/cms-community/hippo-testsuite/blob/hippo-testsuite-4.2.0/content/src/main/resources/hcm-content/resourcebundles.yaml and it has two variants for both live and preview under the document handle node:

/content/documents/productresources:
  jcr:primaryType: hippo:handle
  jcr:mixinTypes: ['hippo:hardhandle']
  /productresources[1]:
    jcr:primaryType: resourcebundle:resourcebundle
    jcr:mixinTypes: ['hippo:harddocument']
    hippo:availability: [live]
    hippostd:state: published
    resourcebundle:id: org.onehippo.hst.demo.resources.ProductResources
    resourcebundle:keys: [brand, product, type, color, price, tags, image]
    resourcebundle:messages: [Brand, Product, Type, Color, Price, Tags, Image]
    resourcebundle:messages_en: [Brand, Product, Type, Color, Price, Tags, Image]
    resourcebundle:messages_fr: [Marque, Produit, Type, Couleur, Prix, Balises, Image]
  /productresources[2]:
    jcr:primaryType: resourcebundle:resourcebundle
    jcr:mixinTypes: ['hippo:harddocument']
    hippo:availability: [preview]
    hippostd:state: unpublished
    resourcebundle:id: org.onehippo.hst.demo.resources.ProductResources
    resourcebundle:keys: [brand, product, type, color, price, tags, image]
    resourcebundle:messages: [Brand, Product, Type, Color, Price, Tags, Image]
    resourcebundle:messages_en: [Brand, Product, Type, Color, Price, Tags, Image]
    resourcebundle:messages_fr: [Marque, Produit, Type, Couleur, Prix, Balises, Image]

Please note that the HST Resource Bundle feature supports context awareness based on preview or live mode. So, if you visit a preview mode site, then resource bundles are automatically selected only from the preview variants of resource bundle documents. If you visit a live mode site, then resource bundles are automatically selected only from the live variants of resource bundle documents.

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?