First and foremost, there is a NEW simple interface to support XLIFF. It has two simple APIs – one for generating XLIFF from AEM XML (export workflows) and the second one is for ingesting XLIFF back into AEM by converting that to AEM XML. For folks who like to see the parameters, here are the exact APIs:
public interface TranslationXLIFFService {
/**
* Converts an XML document, corresponding to a translation object, to an equivalent XLIFF string
* @param xmlDocument XML document containing the content to be translated
* @param id Unique id corresponding to the translation object from which the xmlDocument was created
* @param sourceLanguage Source language of the translatable content inside xmlDocument
* @param xliffVersion Version of the output XLIFF
* @return String containing the complete XLIFF
* @throws TranslationXLIFFServiceException
*/
String convertXMLDocumentToXLIFFString(Document xmlDocument, String id, String sourceLanguage, String xliffVersion)
throws TranslationXLIFFServiceException;
/**
* Converts an XLIFF InputStream to an equivalent XML
* @param xliffInputStream Input XLIFF stream
* @param sourceLanguage Source language
* @param destinationLanguage Target language
* @return XML Document
* @throws TranslationXLIFFServiceException
*/
Document convertXLIFFStreamToXMLDocument(InputStream xliffInputStream, String sourceLanguage, String destinationLanguage)
throws TranslationXLIFFServiceException;
}
This interface can either be implemented by an AEM user, or there is an implementation available on PackageShare. For the purposes, of this blog post, we are going to install the package from Package Share.
Download package from here: https://www.adobeaemcloud.com/content/marketplace/marketplaceProxy.html?packagePath=/content/companies/public/adobe/packages/com.adobe.granite.translation.xliff/okapi-xliff-service-pkg
Once you have the package, install it on AEM using Package Manager (http://localhost:4502/crx/packageshare/index.html). This package supports both XLIFF 1.2 and XLIFF 2.0
Now the Translation Connectors can request XLIFF using the Translation Service. However, in case you do not use a connector and want to use Import/Export workflow from Translation Projects / Jobs, you will need to additionally set another option in the Felix Console. Follow these steps to enable XLIFF for Import/Export workflows:
Browse to Felix Console Configuration Manager (http://localhost:4502/system/console/configMgr)
Search for “Translation Platform Configuration” and click open it
Select the right XLIFF format here.
Once this property is set, if you Export a Translation Job, it will export the content in that specific XLIFF version.
Please note, this setting applies across the AEM instance.
No comments:
Post a Comment
If you have any doubts or questions, please let us know.