Uploaded image for project: '[Read Only] - Hippo Plugins'
  1. [Read Only] - Hippo Plugins
  2. HIPPLUG-1408

Taxonomy: org.onehippo.taxonomy.api.Category.getInfo(String) does not return localized CategoryInfo object

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Normal
    • Resolution: Fixed
    • taxonomy-3.1.0
    • taxonomy-3.1.1
    • plugins-taxonomy
    • None

    Description

      I have a taxonomy with localized category names for English. For example:

      /content/taxonomies/exampletaxonomy/exampletaxonomy
        + clothing
          + shirts
            + long-sleeved-shirts
              + hippotaxonomy:categoryinfos
                + en
                  - hippotaxonomy:name = Long-Sleeved Shirts
      

      In my HST component, I make the org.onehippo.taxonomy.api.Taxonomy object available as request attribute "taxonomy".

      TaxonomyManager taxonomyManager = HstServices.getComponentManager()
              .getComponent(TaxonomyManager.class.getName());
      Taxonomy taxonomy = taxonomyManager.getTaxonomies().getTaxonomy("exampletaxonomy");
      request.setAttribute("taxonomy", taxonomy);
      

      In my Freemarker template, I have:

      <ul>
      <#list document.keys as key>
        <li>
          <#list taxonomy.getCategoryByKey(key).ancestors as ancestor>
            $\{ancestor.getInfo(hstRequest.locale.language).name\} &gt;
          </#list>
          $\{taxonomy.getCategoryByKey(key).getInfo(hstRequest.locale.language).name\}
        </li>
      </#list>
      </ul>
      

      However, instead of the localized names, the keys are printed. It turns out I'm getting a TransientCategoryInfoImpl object.

      Attachments

        1. debug1.png
          debug1.png
          249 kB
        2. debug2.png
          debug2.png
          249 kB

        Activity

          People

            Unassigned Unassigned
            nvankampenhout Niels van Kampenhout
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: