Skip to content

useNotificationTranslation() ​

WARNING

Single File Component (SFC) support for Administration extensions is experimental. It is available since Shopware 6.7.16.0. The APIs described on this page can still change without a deprecation. Try it out and tell us what you find, but do not ship an extension built on it to customers or to the Shopware Store until the API is declared stable (planned for 6.9).

ts
import { useNotificationTranslation } from 'shopware:composables';

function useNotificationTranslation(): {
    getTranslatedTitle: (notification: NotificationType) => string;
    getTranslatedMessage: (notification: NotificationType) => string;
};

The rendering helpers the notification components share. A snippet key is translated and a plain string passes through, so the same notification works either way.

getTranslatedMessage() also sanitizes what it returns, down to a, b, i, u, strong, em and br, with href and target as the only attributes. A notification message may therefore carry a link, but nothing else.

Replaces the notification-translation mixin.

Was this page helpful?
UnsatisfiedSatisfied
Be the first to vote!
0.0 / 5  (0 votes)