Skip to content

Automated facets label translation #713

Description

@CapiauD

Summary

Facets generated automatically from a product field (via the ProductIndexSchemaExtender) use the index field name as their label, word for word. The translated names of the product field are never used, so on multilingual solutions every language shows the same label, usually in the default language. The only way around it today is customizing the facet template and maintaining a separate translation key per facet per language, while those translations already exist on the product field. Automatic facets should show the product field's name in the language of the current context.

Image

Acceptance criteria

  • An automatic facet on a product field shows the field's translated name in the active frontend language
  • When no translation exists for the active language, the label falls back to the current index field name
  • This works for facets created via "Use as facet" and via the ProductIndexSchemaExtender
  • No template customization is needed in Swift to get translated labels
  • Facets with a manually defined name in a facet group keep their current behavior
Technical details

Validated against: DynamicWeb 10, Swift 2 (confirmed by DynamicWeb support: https://doc.dynamicweb.com/forum?ThreadID=101711&PID=1605)
Feature flag / config: "Use as facet" enabled on a product category field; product index built with ProductIndexSchemaExtender

Root causes

  1. The automatic facet takes the index field Name verbatim and holds no reference back to the source product field or its translations.

Proposed changes

  1. Keep a reference from the index field / automatic facet to the source product field, and resolve the facet label at render time through that field's translation for the current language, falling back to the index field Name.

Existing code to reuse

  • Existing product field name translations managed in the backoffice

Alternatives rejected

  • @Translate(facet.Name) in the facet template plus translation keys per language: works, but requires a template customization and duplicates translations that already exist on the product field
  • Separate facet groups per language: loses automatic faceting and multiplies configuration

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Feature requestNew feature or requestProductsFor items related to Products

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions