Skip to content

Widget Editor: Inconsistent translation logic #3650

Description

@astapc

When a custom widget is created (e.g. an element tree widget named my-widget), its name field acts as a translation key. While the translation is correctly applied in some places (e.g. the tab/border title in the widget manager, which goes through useWidgetTitlet(config.translationKey)), it is not applied in the perspective editor's widget configuration card.

The component WidgetConfigurationCardItem renders the widget name directly from the WidgetConfig object without passing it through the translation function:

<span>{widget.name}</span>

This means users see the raw translation key (e.g. my-widget) instead of the translated label (e.g. My Widget) when viewing or editing widgets inside the perspective editor.

Expected behavior

The widget name should be translated using t(widget.name) so that the translated label is consistently shown across all UI locations, including the perspective editor card item.

Actual behavior

The raw widget name (translation key) is displayed in the perspective editor card item instead of the translated label.

Affected file

assets/js/src/core/modules/perspective-editor/components/perspective-form/components/widget-configurator/components/widget-configuration-card-item/widget-configuration-card-item.tsx

Proposed fix

Add the useTranslation hook and replace the raw widget.name reference:

const { t } = useTranslation()
// ...
<span>{t(widget.name)}</span>

Reference: PEES-1151

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

Affected capability

None yet

Platform Version

None yet

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions