CoreMedia Content Cloud v11 Upgrade Guide / Version 2110
Table Of Contents
With the previous API, localizing a custom content type was accomplished by overriding the resource bundle
ContentTypes_properties
with a custom resource bundle:
new CopyResourceBundleProperties({ destination: resourceManager.getResourceBundle(null, ContentTypes_properties), source: resourceManager.getResourceBundle(null, BlueprintDocumentTypes_properties), })
The custom resource bundle typically included properties like (for a content type named "Media"):
Media_text: "Media Object", Media_toolTip: "Multimedia object", Media_icon: "custom-icons custom-icons--type-media", Media_alt_text: "Alternative Text", Media_alt_toolTip: "Alternative text shown in case of render failures", Media_alt_emptyText: "Enter an alternative text here.", Media_caption_text: "Caption", Media_caption_toolTip: "Caption of the media object", Media_settings.copyright_text: "Copyright", Media_settings.copyright_toolTip: "Copyright", Media_settings.copyright_emptyText: "Enter copyright information here.",
The new API still relies on resource bundles to actually localize texts. But it utilizes a new registry API to explicitly register and query content type localizations. The example from above is transferred into:
import typeMedia from "./icons/type-media.svg"; contentTypeLocalizationRegistry.addLocalization("Media", { displayName: BlueprintDocTypes_properties.Media_displayName, description: BlueprintDocTypes_properties.Media_description, svgIcon: typeMedia, properties: { alt: { displayName: BlueprintDocTypes_properties.Media_alt_displayName, description: BlueprintDocTypes_properties.Media_alt_description, emptyText: BlueprintDocTypes_properties.Media_alt_emptyText, }, caption: { displayName: BlueprintDocTypes_properties.Media_caption_displayName, description: BlueprintDocTypes_properties.Media_caption_description, }, settings: { properties: { copyright: { displayName: BlueprintDocTypes_properties.Media_copyright_displayName, description: BlueprintDocTypes_properties.Media_copyright_description, emptyText: BlueprintDocTypes_properties.Media_copyright_emptyText, }, } } }, });
The content type icon is directly imported from an SVG file. contentTypeLocalizationRegistry
is a global
constant of type ContentTypeLocalizationRegistry
which also allows to query for existing localizations. In
addition, existing localizations can be updated with the same method addLocalization
from above.
The Blueprint workspace already contains numerous modules using the new API under apps/studio-client/shared/js
.
It is important to note that these shared modules need to be included in both the Main Studio App as well as the Workflow
App. As usual, they can be included as a direct dependency (like @coremedia-blueprint/studio-client.blueprint-doctypes
)
or as an extension dependency (like @coremedia-blueprint/studio-client.lc
).