If you work with content in multiple languages and want to derive translated documents from source documents in a primary language, you can support the editors by providing a side-by-side view of both documents. To this end, a resolution strategy for matching translated documents can be configured.
A source language document resolver is simply a function that takes a Content
object as its single argument and returns the Content
from which the given
content was derived. If no source document is available, the resolver returns null. So that
the document forms for the translated document and the source document can be properly aligned
in the side-by-side view, the returned content must belong to the same content type as the
argument content. In the document model of CoreMedia Blueprint, the resolver function can
simply follow the link list master
to determine a source document.
public function resolveMasterDocument(content:Content):Content { var contentProperties:ContentProperties = content.getProperties(); if (contentProperties) { var readOnlyContents:Array = contentProperties.get('master') as Array; if (readOnlyContents) { return readOnlyContents[0] as Content; } } return null; }
Example 7.19. Blueprint source language document resolver
To configure a source language document resolver, the configureDocumentTypes
Studio plugin can be used. A resolver is used for the given content type and all subtypes. If
multiple resolvers are available, the resolver for the more specific content type takes
precedence.
<editor:configuration> <editor:configureDocumentTypes names="CMLocalized" sourceLanguageDocumentResolver="{resolveMasterDocument}"/> </editor:configuration>
Example 7.20. Configuring a source language document resolver