A master Scheduled Import must be defined for all repositories being translated to pre-process all inbound translation update files. The Scheduled Import will retrieve a single file from the source (e.g., from the designated FTP server directory) then invoke the PrepareTranslationUpdate pre-processing block. The pre-processing block will launch a Scheduled Import Job with the proper settings, then proceed to update the CN_Translation_Log entries to signify the response to the request has been received and processed. The Scheduled Import should have the following settings:
Attribute Name | Value |
---|---|
Import Name | CN_Language_Translation_Response |
Import Type | Template |
Preprocess File | Yes |
Preprocess Class | com.enterworks.services.changenotification.ProcessLanguageTranslationResponse |
Preprocess Keys Preprocess Values |
See Preprocess details below |
Import Directory Name | Directory in which the Language Translation Responses will be placed |
Import File Name | Must match the common portion of the language translation request files generated by each Translation Request Scheduled Export. For example, if exports are defined names in the format: LTR_<language>_<batchId>.csv, the Import File Name should be: LTR_*.csv. |
Import Format | CSV |
Move Import File | Yes |
Skip File Check | No |
Template Name | CN_Translation_Request_Log |
Repository Name | CN_Translation_Log |
Dependent Operation Type | Import |
Dependent Operation | CN_Language_Translation_Response |
Dependent Operation Immediate | Yes |
The Preprocess Class ProcessLanguageTranslationResponse reads the response file, identifies the CN_Translation_Registry for the file, pulls the Import Template from the entry and generates an import file for that Import template to update the translation target language with the values in the file. A separate Scheduled Import job is launched to process this file. The pre-process class also creates a separate file for updating the CN_Translation_Log. The pre-process class has the following arguments:
Argument | Description |
---|---|
fileEncoding | Specifies the encoding for files. The default is UTF-8 |
requestFileFormat | Format for the request file: XLSX or CSV |
pivotFileDirectoryName | Location of where the Translation Log import files are to be placed for processing. The Scheduled Import must have this same directory name |
logFileImportTemplate | ||Template Name|| - Name of the import template used to update the CN_Translation_Log repository. This import template must be defined as the Template Name in this Scheduled Import |
logFileName | TR_UpdateLog_||Import Job||.csv - Name of the Translation Log import file. |
templateScheduledImport | CN_Language_Translation_Response_Template - Name of the template Scheduled Import to be used when creating each language translation import. The contents of this Scheduled Import are copied to the Scheduled Import Jobs and the particulars (such as file name, language, repository name, or import template name) are updated in the record before the import job is processed. |
The following example shows the configuration of the ProcessLanguageTranslationResponse pre-processing:
The templateScheduledImport must point to a Scheduled Import template that will be the basis of all Language Translation Response jobs.
The preprocessing reads the contents of the file, identifying the associated Translation Registry entry, which identifies the repository name and multi-language attributes. The contents of the file are pivoted so that each row contains all multi-language columns for the same record. This file will be imported into the target repository for the target language identified in the file using the Import Template defined in the Translation Registry entry. A second file is created containing the updates for the Change Notification Translation Log repository.
The first file has the following format:
Column Name | Description |
---|---|
<primaryKeyAttributes> | Up to 5 primary key columns (depending upon the repository), with the column name being the actual primary key attribute names. |
<multiLanguageAttributes> | One column for every attribute listed in the referenced Translation Registry record. |
This second file contains:
Column Name | Description |
---|---|
CN_Repository_Name | Name of the repository |
CN_PK1 | First primary key |
CN_PK2 | Second primary key (empty if repository has only one primary key) |
CN_PK3 | Third primary key (empty if repository has fewer than three primary keys) |
CN_PK4 | Fourth primary key (empty if repository has fewer than four primary keys) |
CN_PK5 | Fifth primary key (empty if repository has fewer than five primary keys) |
CN_Attribute_Name | Name of the multi-language attribute |
CN_Attribute_Language | Language extension of the source value for the attribute (empty if the default language) |
CN_Translate_Language | Language extension of the target language |
CN_Request_Status | Set to "Updated" |
CN_Request_Date | Set to the current date. |
CN_Translated_Value | Translation for the value. |
Once pre-processing is complete, a Scheduled Import Job record is created and a job launched to process the target repository update file. This scheduled import job is used as the basis for the new job, but all of the appropriate attributes are updated to reflect the generated file name, target repository name, target language, and import template name. If the job is successfully launched, this import job proceeds to import the second file to update the Request Status in the corresponding records in the Change Notification Translation Log repository.