How to export and import WCM library content using DXClient | HCL Digital Experience

The HCL Multilingual Solution (MLS) export and import capability allows you to support translation of the content of a library by exporting it into a format supported by a translation service and importing the translated content back into HCL Digital Experience using the DXClient tool.

Prerequisites

  • The libraries for the other languages for translated are already existing and are filled with the content from the main language library, like with the MLS copy portlet.
  • The DXClient tool is used to manage the library export and import functions by providing an integrated solution to export and import CSV files for translation. The DXClient export and import process works on HCL Digital Experience 9.5 only. See the DXClient topic for more information.

About this task

There are two separate commands for handling bulk translations, export and import. These commands deal with the translation of all the WCM library contents. Note, however, that only the following WCM content elements are translated: short text, rich text, and HTML.
  • The export command exports the source contents from a library into a CSV file with an auto generated file name at the location specified by the user. This command creates a new CSV file every time the command is run.
  • The import command overwrites any existing translations in the content of the environment.
  • All the default command options in this section are configured inside the - dist/src/configuration/config.json file of the tool. The options passed through command line overrides these default values.
Note: Only the ShortTextComponent element type has an explicit maximum data length set at 250 characters. The import command validates the length of the data for this element type before importing. Errors due to custom configuration of limits are caught by the import and export during the cycle and are reported in an error log.

Export command

The export command is used to export the content of a WCM library for translation into a CSV file at the location specified by the user.

Export command:
dxclient mls-export
Export help command:
dxclient mls-export -h
Export command options:
  • -dxProtocol <value> - use this attribute to specify the protocol to use to connect to the DX server.
  • -hostname <value> - use this attribute to specify the host name of the DX server.
  • -dxPort <value> - use this attribute to specify the port on which to connect to the DX server.
  • -contenthandlerPath <value> - use this attribute to specify the path to the contenthandler servlet on the DX server (for example, /wps/mycontenthandler).
  • -dxUsername <value> - use this attribute to specify the user name required for authenticating with the server.
  • -dxPassword <value> - use this attribute to specify the password required for authenticating with the server.
  • -wcmLibraryId <value> - provide the WCM library ID to export the contents of the library.
  • -wcmLibraryName <value> - provide the WCM library name to export the contents of the library.
  • -lastModifiedAfter <value> - to export contents from the library which are modified after a certain date and time (in GMT).
  • -wcmProjectName <value> Optional attribute - provide the WCM project name to export the contents of the project.
  • -exportPath <value> - the path to export the WCM contents of a library.
  • -virtualPortalContext <value> - the context of the virtual portal that contains the Script Application instance you want to create or update.
All the command options can be configured inside “config.json” of the tool which are then read as the default. Location of the configuration file - dist/src/configuration/config.json. The options passed through command line overrides these default values.

Usage sample:

To export contents from multiple libraries using multiple library ids :
dxclient mls-export -dxProtocol <dxProtocol> -hostname <hostname> -dxPort <dxPort> 
-contenthandlerPath <contenthandlerPath> -dxUsername <dxUsername> -dxPassword <dxPassword> -wcmLibraryId <wcmLibraryId> -exportPath <exportPath> -virtualPortalContext <virtualPortalContext>
To export contents from multiple libraries using multiple library names :
dxclient mls-export -dxProtocol <dxProtocol> -hostname <hostname> -dxPort <dxPort> 
-contenthandlerPath <contenthandlerPath> -dxUsername <dxUsername> -dxPassword <dxPassword> -wcmLibraryName <wcmLibraryName>,<wcmLibraryName> -exportPath <exportPath> -virtualPortalContext <virtualPortalContext>
To export contents from library using specified date and time in GMT:
dxclient mls-export -dxProtocol <dxProtocol> -hostname <hostname> -dxPort <dxPort> 
-contenthandlerPath <contenthandlerPath> -dxUsername <dxUsername> -dxPassword <dxPassword> -wcmLibraryId <wcmLibraryId> -lastModifiedAfter <lastModifiedAfter> -exportPath <exportPath> -virtualPortalContext <virtualPortalContext>
To export contents from project using project name :
dxclient mls-export -dxProtocol <dxProtocol> -hostname <hostname> -dxPort <dxPort> 
-contenthandlerPath <contenthandlerPath> -dxUsername <dxUsername> -dxPassword <dxPassword> -wcmProjectName <wcmProjectName> -exportPath <exportPath> -virtualPortalContext <virtualPortalContext>

Import command

The import command is used to import the translated content into DX and overwrites any existing translations in the content of the environment.

Import command:
dxclient mls-import
Import help command:
dxclient mls-import -h
Import command options:
  • -dxProtocol <value> - use this attribute to specify the protocol to use to connect to the DX server.
  • -hostname <value> - use this attribute to specify the host name of the DX server.
  • -dxPort <value> - use this attribute to specify the port on which to connect to the DX server.
  • -contenthandlerPath <value> - use this attribute to specify the path to the contenthandler servlet on the DX server (for example, /wps/mycontenthandler).
  • -dxUsername <value> - use this attribute to specify the user name required for authenticating with the server.
  • -dxPassword <value> - use this attribute to specify the password required for authenticating with the server.
  • -importPath <value> - the path to import the translated contents into DX.
  • -wcmProjectName <value> Optional attribute - use this attribute to specify the project for which the contents to be imported.
  • -virtualPortalContext <value> - the context of the virtual portal that contains the Script Application instance you want to create or update.
All the command options can be configured inside “config.json” of the tool which are then read as default. Location of the configuration file - dist/src/configuration/config.json. The options passed through command line overrides these default values.

Usage sample:

To import contents to portal :
dxclient mls-import -dxProtocol <dxProtocol> -hostname <hostname> -dxPort <dxPort> 
-contenthandlerPath <contenthandlerPath> -dxUsername <dxUsername> -dxPassword <dxPassword> -importPath <importPath> -virtualPortalContext <virtualPortalContext>
To import the content to project :
dxclient mls-import -dxProtocol <dxProtocol> -hostname <hostname> -dxPort <dxPort> 
                    -contenthandlerPath <contenthandlerPath> -dxUsername <dxUsername> -dxPassword <dxPassword> -importPath <importPath> -wcmProjectName <wcmProjectName> -virtualPortalContext <virtualPortalContext>

Maximum data length for importing the translated contents

Only ShortTextComponent element type has an explicit maximum data length defined as 250 characters. Import command would validate the length of the data for this particular element type before proceeding with the actual import flow. Any errors due to custom configuration of limits are caught by the import/export during the execution cycle and the error log is reported.

CSV file length limits

Only ShortTextComponent element type has an explicit maximum data length defined as 250 characters. And this limit is seen by users in the CSV file as new column called fieldLimit is added.

Content information data

Content specific information rows namely title and description has been provided in the CSV file. User can edit the title and description of the content while importing the contents to portal.

Sample pipelines

You can use the sample pipelines in this section to run MLS export and import. The sample pipelines (available under the samples folder in the DXClient root folder) can be used by developers and administrators as a basis for Jenkins automation server jobs.

These samples show how to install the DXClient tool in a pipeline and then export and import the MLS. These are designed to run from a Jenkins job with the parameters indicated.
Note: For additional sample pipelines supporting DX release operations, reference this Help Center topics Sample Pipelines for use with HCL DXClient and Automation servers, Sample Pipelines for the node package file and Sample Pipelines for the Docker image file.
MLS Export
Table 1. MLS Export
Parameter Value Notes
AGENT_LABEL Jenkins agent label Determines the agents the pipeline can run
TOOL_PACKAGE_URL URL to DXClient zip Fetched via curl
TOOL_CREDENTIALS_ID Credentials ID in Jenkins store The user name and password needed to access the tool package URL
DX_CREDENTIALS_ID Credentials ID in Jenkins store The user name and password needed to access DX server
DX_PROTOCOL Protocol to connect to the DX server HTTP or HTTPS
DX_HOST Host name or IP address of the DX server Artifacts are deployed to this server
DX_PORT Port to connect to the DX server Port for the DX main profile
CONTENT_HANDLER_PATH Alternate path for the portal context root or the content handler servlet Default path: /wps/mycontenthandler/
WCM_LIBRARY_ID WCM library ID to export the contents of the library Exports the available content from this library ID
EXPORT_PATH The path to export the WCM contents of a library The path where the content is exported
Figure 1. DXClient MLS export pipeline sample
MLS Import
Table 2. MLS Import
Parameter Value Notes
AGENT_LABEL Jenkins agent label Determines the agents the pipeline can run
TOOL_PACKAGE_URL URL to DXClient zip Fetched via curl
TOOL_CREDENTIALS_ID Credentials ID in Jenkins store The user name and password needed to access the tool package URL
DX_CREDENTIALS_ID Credentials ID in Jenkins store The user name and password needed to access DX server
ARTIFACT_CREDENTIALS_ID Credentials ID in Jenkins store The user name and password needed to access artifact URLs
ARTIFACT_PATH URL (except file names) for artifacts to be deployed Artifacts fetched via curl
DX_PROTOCOL Protocol to connect to the DX server HTTP or HTTPS
DX_HOST Host name or IP address of the DX server Artifacts are deployed to this server
DX_PORT Port to connect to the DX server Port for the DX main profile
CONTENT_HANDLER_PATH Alternate path for the portal context root or the content handler servlet Default path: /wps/mycontenthandler/
IMPORT_FILE_NAME File name to import the translated content into DX Imports the content from this file
Figure 2. DXClient MLS import pipeline sample