RWS Logo
Show / Hide Table of Contents

Edge Operations

This section contains the Edge specific setup and operations.

Building the EdgeLanguageWeaverClient

Using default configuration:

try {
    const edgeLanguageWeaverClient = await new EdgeLanguageWeaverClient()
        .build();
    // perform requests
} catch (e) {
    // handle errors;
}
Note

The default setup is the following:

  • API credentials loaded from environment variables
  • Default retry mechanism (retry up to 3 times, with a delay of 5 seconds)
  • Using http://localhost:8001 url

Using custom configuration - ClientConfiguration:

try {
    const retryConfiguration = new RetryConfiguration();
    retryConfiguration.attempts = 3;
    retryConfiguration.delay = 5000; // milliseconds
    const clientConfiguration = new ClientConfiguration();
    clientConfiguration.credentialsConfiguration = new CredentialsConfiguration("clientId");
    clientConfiguration.retryConfiguration = retryConfiguration;

    let edgeLanguageWeaverClient = new EdgeLanguageWeaverClient()
        .withConfigurations(clientConfiguration);
    edgeLanguageWeaverClient.overwriteUrl = "https://customurl.com";
    edgeLanguageWeaverClient = await edgeLanguageWeaverClient.build();
    // perform requests
} catch (e) {
    // handle errors
}

See API credentials and ClientConfiguration setup.
See API URL setup.

Using custom configuration - TokenConfiguration:

try {
    const token = new Token("accessToken", 86400, "tokenType", 1663409635000);
    const tokenConfiguration = new TokenConfiguration();
    tokenConfiguration.token = token;

    let edgeLanguageWeaverClient = new EdgeLanguageWeaverClient()
        .withTokenConfigurations(tokenConfiguration);
    edgeLanguageWeaverClient.overwriteUrl = "https://customurl.com";
    edgeLanguageWeaverClient = await edgeLanguageWeaverClient.build();
    // perform requests
} catch (e) {
    // handle errors
}

See TokenConfiguration setup.

Get all Language Pairs

By using the getEdgeLanguagePairs method from EdgeLanguageWeaverClient, the list of available language pairs will be returned, corresponding to the given client identifier. These will be used for translation requests.

try {
    const edgeLanguageWeaverClient = await new EdgeLanguageWeaverClient().build();
    const languagePairsResult = await edgeLanguageWeaverClient.getEdgeLanguagePairs();
    // handle result
} catch (e) {
    // handle errors
}

See the complete samples on GitHub:

  • backend
  • browser

The EdgeLanguagePairsResult object contains the following information:

Name Type Description
languagePairs EdgeLanguagePair array Contains a list of EdgeLanguagePair objects

The EdgeLanguagePair object contains the following information:

Name Type Description
languagePairId string Language pair identifier
sourceLanguage string Full name of source language
sourceLanguageId string Three letters language code of the source language
targetLanguage string Full name of target language
targetLanguageId string Three letters language code of the target language
model string String representing a unique identifier for the language pair combination sourceLanguageId-targetLanguageId-model. (e.g. Generic)
platform string Platform on which language pair runs
technology string Technology type of language pair
version string Version of the language pair
memberPairs MemberPair array Contains a list of MemberPair object
isChain boolean Indicates if the language pair is a chain
linguisticOptions EdgeLinguisticOption array List of available linguistic options as an array

The MemberPair object contains the following information:

Name Type Description
languagePairId string Language pair identifier
sourceLanguage string Full name of source language
sourceLanguageId string Three letters language code of the source language
targetLanguage string Full name of target language
targetLanguageId string Three letters language code of the target language
model string String representing a unique identifier for the language pair combination sourceLanguageId-targetLanguageId-model. (e.g. Generic)
platform string Platform on which language pair runs
technology string Technology type of language pair
version string Version of the language pair

The EdgeLinguisticOption object contains the following information:

Name Type Description
id string Linguistic option identifier
systemDefault string System default linguistic option
values string array Available values for the current linguistic option

Get all Linguistic Options for a Language Pair

By using the getEdgeLinguisticOptions method from EdgeLanguageWeaverClient, the list of available linguistic options of a specific language pair will be returned, corresponding to the given client identifier. These will be used for translation requests.

try {
    const edgeLanguageWeaverClient = await new EdgeLanguageWeaverClient().build();
    const request = new EdgeGetLinguisticOptionsRequest();
    request.sourceLanguageId = "chi";
    request.targetLanguageId = "eng";
    request.model = "Generic";
    // request.platform = "SRV";
    // request.technology = "TNMV";
    const linguisticOptionsResult = await edgeLanguageWeaverClient.getEdgeLinguisticOptions(request);
    // handle result
} catch (e) {
    // handle errors
}

See the complete samples on GitHub:

  • backend
  • browser

The EdgeGetLinguisticOptionsRequest object contains the following information:

Name Type Mandatory Default value Description
sourceLanguageId string yes Three letters language code of the source language
targetLanguageId string yes Three letters language code of the target language
model string yes Model of language pair
platform string no Platform on which language pair runs
technology string no Technology type of language pair

The EdgeGetLinguisticOptionsRequest object can be obtained from an existing EdgeLanguagePair object as well using the toEdgeGetLinguisticOptionsRequest() method:

const edgeLinguisticOptionsRequest = edgeLanguagePair.toEdgeGetLinguisticOptionsRequest();

The EdgeLinguisticOptionsResult object contains the following information:

Name Type Description
linguisticOptions EdgeLinguisticOption array List of linguistic options available for the requested language pair

The EdgeLinguisticOption object contains the following information:

Name Type Description
id string Linguistic option identifier
systemDefault string System default linguistic option
values string array Available values for the current linguistic option

Get all Dictionaries

By using the getEdgeDictionaries method from EdgeLanguageWeaverClient, the list of available dictionaries will be returned, corresponding to the given client identifier. These can be used for translation requests.

try {
    const edgeLanguageWeaverClient = await new EdgeLanguageWeaverClient().build();
    const dictionariesResult = await edgeLanguageWeaverClient.getEdgeDictionaries(1);
    // handle result
} catch (e) {
    // handle errors
}

See the complete samples on GitHub:

  • backend
  • browser

The getEdgeDictionaries method has the following parameters:

Name Type Mandatory Default Description
pageNumber number yes Number specifying the requested page number
pageSize number no 100 Number specifying the requested page size

The EdgeDictionariesResult object contains the following information:

Name Type Description
dictionaries EdgeDictionary array Contains a list of EdgeDictionary objects
pageNumber number Number specifying the requested page number
pageSize number Number of dictionaries returned per page
totalPages number Total number of pages available
totalCount number Total number of dictionaries

The EdgeDictionary object contains the following information:

Name Type Description
dictionaryId string Dictionary identifier
sourceLanguageId string Three letters language code of the source language
targetLanguageId string Three letters language code of the target language

Translations

Perform a Text Translation

The translateTextUsingEdgeParams method from EdgeLanguageWeaverClient, performs a text translation using a required EdgeTranslateTextRequest object.

try {
    const edgeLanguageWeaverClient = await new EdgeLanguageWeaverClient().build();
    const translateTextRequest = new EdgeTranslateTextRequest();
    translateTextRequest.languagePairId = "EngFra_Generic_SRV_TNMV_8_5_x_1";
    translateTextRequest.addInput("The weather is wonderful today!");
    translateTextRequest.inputFormat = Format.PLAIN;
    // provide list of dictionaries
    translateTextRequest.addDictionary("DictionaryName1");
    translateTextRequest.addDictionary("DictionaryName2");
    const translateTextResult = await edgeLanguageWeaverClient.translateTextUsingEdgeParams(translateTextRequest);
    // handle result
} catch (e) {
    // handle errors
}

See the complete samples on GitHub:

  • backend
  • browser

The EdgeTranslateTextRequest object contains the following information:

Name Type Mandatory Default value Description
languagePairId string yes Identifier of language pair or language pair chain to use for translation; e.g., EngFra_Generic_SRV_PBL_7_4_x_1 or ChiEng_Generic_SRV_PBL_7_4_x_1 >> EngFra_Generic_SRV_PBL_7_4_x_1.
To automatically detect the source language, use AutXxx, where Xxx is the 3-letter code of the desired target language. The AutXxx pattern cannot be used with language pair chains.
inputFormat Format no Format of input content (see table of possible input formats)
input string array yes Content to be translated. Input is added using the addInput method. This can be called multiple times in order to perform array translations.
dictionaries string array no empty A string array containing dictionary ids. Dictionaries are added using the addDictionary method. This can be called multiple times if multiple dictionaries need to be used in a translation.
outputFormat Format no Format of output document (see table of possible output formats)
title string no Title of translation job
encoding string no Encoding of input content (see list of supported character encodings)
linguisticOptions Map of strings no Map of strings containing pairs of linguistic option name and value. Values are case sensitive. You can only use the linguistic options that are available for that specific language pair. You can see what linguistic options are available for a language pair using this method call: Linguistic Options
Note

In order to use Linguistic Options feature you must enable it in your account

Text Input formats

Name Description
HTML HTML
PLAIN Plain text (UTF8)
XLINE Plain text, one sentence per line
TMX Translation Memory eXchange
XLIFF XML Localization Interchange File Format
BCM Proprietary format
XML Extensible Markup Language
SDLXML Treats every closing XML tag in the input as the end of a segment. The XML format in contrast does not make this assumption.

The EdgeTranslationTextResult object contains the following information:

Name Type Description
languagePairId string Language pair identifier
translation string Translated content

Perform a File Translation

The translateFileUsingEdgeParams method from EdgeLanguageWeaverClient, performs a file translation using a required EdgeTranslateFileRequest object.

Backend JavaScript Environment

try {
    const edgeLanguageWeaverClient = await new EdgeLanguageWeaverClient().build();
    const translateFileRequest = new EdgeTranslateFileRequest();
    translateFileRequest.languagePairId = "EngFra_Generic_SRV_TNMV_8_5_x_1";
    // provide full path to the source file 
    translateFileRequest.input = path.resolve("/src/resources/input/input1.txt");
    // provide full path to the target directory
    translateFileRequest.outputDir = path.resolve("/src/resources/output");
    translateFileRequest.outputFile = "input1-translated.txt";
    translateFileRequest.inputFormat = Format.PLAIN;
    // provide list of dictionaries
    translateFileRequest.addDictionary("DictionaryName1");
    translateFileRequest.addDictionary("DictionaryName2");
    await edgeLanguageWeaverClient.translateFileUsingEdgeParams(translateFileRequest);
} catch (e) {
    // handle errors
}

See the complete sample on GitHub.

The EdgeTranslateFileRequest object contains the following information:

Name Type Mandatory Default value Description
languagePairId string no* Identifier of language pair or language pair chain to use for translation; e.g., EngFra_Generic_SRV_PBL_7_4_x_1 or ChiEng_Generic_SRV_PBL_7_4_x_1 >> EngFra_Generic_SRV_PBL_7_4_x_1.
To automatically detect the source language, use AutXxx, where Xxx is the 3-letter code of the desired target language. The AutXxx pattern cannot be used with language pair chains.
inputFormat Format no Format of input content (see table of possible input formats)
input string yes The path for the input file that needs to be translated
outputDir string no The path for the output directory that will contain the translated file. Also, the translated content will be returned as part of the TranslationFileResult as a base64 string.
outputFile string no The name of the output file that will contain the translated content. If the outputFile is not provided, the filename is computed based on the input information like sourceLanguageId and targetLanguageId.
dictionaries string array no empty A string array containing dictionary ids. Dictionaries are added using the addDictionary method. This can be called multiple times if multiple dictionaries need to be used in a translation.
outputFormat Format no Format of output document (see table of possible output formats)
title string no Title of translation job
encoding string no Encoding of input content (see list of supported character encodings)
pdfConverter PdfConverter no Converter to use for PDF conversions. Choices: STANDARD to use standard conversion and ABBYY to use ABBYY FineReader for enhanced conversion. If empty, Edge (licensed with ABBYY) will automatically use ABBYY when the source file is a scanned PDF, or if the source language is right-to-left (RTL) script or one of the following: Chinese (Simplified and Traditional), Japanese, Korean, Vietnamese, Thai, Hindi or Burmese; Edge will use standard conversion for all other source languages when the source file is not a scanned PDF.
linguisticOptions Map of strings no Map of strings containing pairs of linguistic option name and value. Values are case sensitive. You can only use the linguistic options that are available for that specific language pair. You can see what linguistic options are available for a language pair using this method call: Linguistic Options
Note
  • For image input formats, output format is PLAIN text (.txt)
  • For EML and MSG input formats, output format is PLAIN text (.txt)
  • For PDF input format, output format is DOCX (.docx)
  • For all other input formats, output format is the same as the input format
Note

In order to use Linguistic Options feature you must enable it in your account

The EdgeTranslationFileResult object contains the following information:

Name Type Description
languagePairId string Language pair identifier
fileContent string Base64 string representing the translated file content.
requestId string Translation request identifier.

Browser JavaScript Environment

try {
    const clientConfiguration = new ClientConfiguration();
    clientConfiguration.credentialsConfiguration = new CredentialsConfiguration(clientId);
    const edgeLanguageWeaverClient = await new EdgeLanguageWeaverClient()
        .withConfigurations(clientConfiguration)
        .build();
    const translateFileRequest = new EdgeTranslateFileRequest();
    translateFileRequest.languagePairId = "EngFra_Generic_SRV_TNMV_8_5_x_1";
    // provide a File object 
    translateFileRequest.input = file;
    translateFileRequest.inputFormat = Format.PLAIN;
    // provide list of dictionaries
    translateFileRequest.addDictionary("DictionaryName1");
    translateFileRequest.addDictionary("DictionaryName2");
    const translateFileResult = await edgeLanguageWeaverClient.translateFileUsingEdgeParams(translateFileRequest);
    // handle result
} catch (e) {
    // handle errors
}

See the complete sample on GitHub.

The EdgeTranslateFileRequest object contains the following information:

Name Type Mandatory Default value Description
languagePairId string no* Identifier of language pair or language pair chain to use for translation; e.g., EngFra_Generic_SRV_PBL_7_4_x_1 or ChiEng_Generic_SRV_PBL_7_4_x_1 >> EngFra_Generic_SRV_PBL_7_4_x_1.
To automatically detect the source language, use AutXxx, where Xxx is the 3-letter code of the desired target language. The AutXxx pattern cannot be used with language pair chains.
inputFormat Format no Format of input content (see table of possible input formats)
input File yes The file (File object) that needs to be translated
dictionaries string array no empty A string array containing dictionary ids. Dictionaries are added using the addDictionary method. This can be called multiple times if multiple dictionaries need to be used in a translation.
outputFormat Format no Format of output document (see table of possible output formats)
title string no Title of translation job
encoding string no Encoding of input content (see list of supported character encodings)
pdfConverter PdfConverter no Converter to use for PDF conversions. Choices: STANDARD to use standard conversion and ABBYY to use ABBYY FineReader for enhanced conversion. If empty, Edge (licensed with ABBYY) will automatically use ABBYY when the source file is a scanned PDF, or if the source language is right-to-left (RTL) script or one of the following: Chinese (Simplified and Traditional), Japanese, Korean, Vietnamese, Thai, Hindi or Burmese; Edge will use standard conversion for all other source languages when the source file is not a scanned PDF.
linguisticOptions Map of strings no Map of strings containing pairs of linguistic option name and value. Values are case sensitive. You can only use the linguistic options that are available for that specific language pair. You can see what linguistic options are available for a language pair using this method call: Linguistic Options
Note
  • For image input formats, output format is PLAIN text (.txt)
  • For EML and MSG input formats, output format is PLAIN text (.txt)
  • For PDF input format, output format is DOCX (.docx)
  • For all other input formats, output format is the same as the input format
Note

In order to use Linguistic Options feature you must enable it in your account

The EdgeTranslationFileResult object contains the following information:

Name Type Description
languagePairId string Language pair identifier
fileContent Blob Blob representing the translated file content.
requestId string Translation request identifier.

Perform a Batch File Translation

The translateBatchFileUsingEdgeParams method from EdgeLanguageWeaverClient, performs a batch file translation using a required EdgeTranslateBatchFileRequest object.

Backend JavaScript Environment

try {
    const edgeLanguageWeaverClient = await new EdgeLanguageWeaverClient().build();
    const translateFileRequest = new EdgeTranslateBatchFileRequest();
    translateFileRequest.languagePairId = "EngFra_Generic_SRV_TNMV_8_5_x_1";
    // provide full path to the input and output folders 
    translateFileRequest.input = path.resolve("/src/resources/input");
    translateFileRequest.outputDir = path.resolve("/src/resources/output");
    // provide list of dictionaries
    translateFileRequest.addDictionary("DictionaryName1");
    translateFileRequest.addDictionary("DictionaryName2");
    await edgeLanguageWeaverClient.translateBatchFileUsingEdgeParams(translateFileRequest);
} catch (e) {
    // handle errors
}

See the complete sample on GitHub.

The EdgeTranslateBatchFileRequest object contains the following information:

Name Type Mandatory Default value Description
languagePairId string no* Identifier of language pair or language pair chain to use for translation; e.g., EngFra_Generic_SRV_PBL_7_4_x_1 or ChiEng_Generic_SRV_PBL_7_4_x_1 >> EngFra_Generic_SRV_PBL_7_4_x_1.
To automatically detect the source language, use AutXxx, where Xxx is the 3-letter code of the desired target language. The AutXxx pattern cannot be used with language pair chains.
input string yes The path to the folder that contains the input files
outputDir string yes The path to the folder where the corresponding translated files will be added
dictionaries string array no empty A string array containing dictionary ids. Dictionaries are added using the addDictionary method. This can be called multiple times if multiple dictionaries need to be used in a translation.
outputFormat Format no Format of output document (see table of possible output formats)
title string no Title of translation job
encoding string no Encoding of input content (see list of supported character encodings)
pdfConverter PdfConverter no Converter to use for PDF conversions. Choices: STANDARD to use standard conversion and ABBYY to use ABBYY FineReader for enhanced conversion. If empty, Edge (licensed with ABBYY) will automatically use ABBYY when the source file is a scanned PDF, or if the source language is right-to-left (RTL) script or one of the following: Chinese (Simplified and Traditional), Japanese, Korean, Vietnamese, Thai, Hindi or Burmese; Edge will use standard conversion for all other source languages when the source file is not a scanned PDF.
linguisticOptions Map of strings no Map of strings containing pairs of linguistic option name and value. Values are case sensitive. You can only use the linguistic options that are available for that specific language pair. You can see what linguistic options are available for a language pair using this method call: Linguistic Options
Note

In order to use Linguistic Options feature you must enable it in your account

The EdgeTranslationBatchFileResult object contains the following information:

Name Type Description
translationFileResults EdgeTranslationFileResult array A EdgeTranslationFileResult array representing the translated files content. If an error occurs while translating a file, the error will not be returned or added to this array.

Browser JavaScript Environment

try {
    const clientConfiguration = new ClientConfiguration();
    clientConfiguration.credentialsConfiguration = new CredentialsConfiguration(clientId);
    const edgeLanguageWeaverClient = await new EdgeLanguageWeaverClient()
        .withConfigurations(clientConfiguration)
        .build();
    const translateFileRequest = new EdgeTranslateBatchFileRequest();
    translateFileRequest.languagePairId = "EngFra_Generic_SRV_TNMV_8_5_x_1";
    // provide list of File objects
    translateFileRequest.input = [file1, file2];
    // provide list of dictionaries
    translateFileRequest.addDictionary("DictionaryName1");
    translateFileRequest.addDictionary("DictionaryName2");
    const translateFileResult = await edgeLanguageWeaverClient.translateBatchFileUsingEdgeParams(translateFileRequest);
    // handle result
} catch (e) {
    // handle errors
}

See the complete sample on GitHub.

The EdgeTranslateBatchFileRequest object contains the following information:

Name Type Mandatory Default value Description
languagePairId string no* Identifier of language pair or language pair chain to use for translation; e.g., EngFra_Generic_SRV_PBL_7_4_x_1 or ChiEng_Generic_SRV_PBL_7_4_x_1 >> EngFra_Generic_SRV_PBL_7_4_x_1.
To automatically detect the source language, use AutXxx, where Xxx is the 3-letter code of the desired target language. The AutXxx pattern cannot be used with language pair chains.
input File array yes The File array that contains the input files
dictionaries string array no empty A string array containing dictionary ids. Dictionaries are added using the addDictionary method. This can be called multiple times if multiple dictionaries need to be used in a translation.
outputFormat Format no Format of output document (see table of possible output formats)
title string no Title of translation job
encoding string no Encoding of input content (see list of supported character encodings)
pdfConverter PdfConverter no Converter to use for PDF conversions. Choices: STANDARD to use standard conversion and ABBYY to use ABBYY FineReader for enhanced conversion. If empty, Edge (licensed with ABBYY) will automatically use ABBYY when the source file is a scanned PDF, or if the source language is right-to-left (RTL) script or one of the following: Chinese (Simplified and Traditional), Japanese, Korean, Vietnamese, Thai, Hindi or Burmese; Edge will use standard conversion for all other source languages when the source file is not a scanned PDF.
linguisticOptions Map of strings no Map of strings containing pairs of linguistic option name and value. Values are case sensitive. You can only use the linguistic options that are available for that specific language pair. You can see what linguistic options are available for a language pair using this method call: Linguistic Options
Note

In order to use Linguistic Options feature you must enable it in your account

The EdgeTranslationBatchFileResult object contains the following information:

Name Type Description
translationFileResults EdgeTranslationFileResult array A EdgeTranslationFileResult array representing the translated files content. If an error occurs while translating a file, the error will not be returned or added to this array.

Retrieve a File Translation

By using the retrieveEdgeFileTranslation method from EdgeLanguageWeaverClient, a file will be returned, corresponding to the given translation request identifier.

Backend JavaScript Environment

try {
    const edgeLanguageWeaverClient = await new EdgeLanguageWeaverClient().build();
    const request = new EdgeRetrieveFileRequest();
    request.requestId = "requestId";
    request.outputDir = path.resolve("resources/output");
    request.outputFile = "input1-translated.txt";
    request.outputFormat = Format.PLAIN;
    const translateFileResult = await edgeLanguageWeaverClient.retrieveEdgeFileTranslation(request);
    console.log(translateFileResult.fileContent);
} catch (e) {
    console.log(e);
}

See the complete sample on GitHub.

The EdgeRetrieveFileRequest object contains the following information:

Name Type Mandatory Default value Description
requestId string yes Translation request identifier
outputDir string yes The path to the folder where the corresponding translated files will be added
outputFile string no The name of the output file that will contain the translated content. If the outputFile is not provided, the filename is computed based on the input information like sourceLanguageId, targetLanguageId and model.
outputFormat Format no Format of output document (see table of possible output formats)
Note
  • For image input formats, output format is PLAIN text (.txt)
  • For EML and MSG input formats, output format is PLAIN text (.txt)
  • For PDF input format, output format is DOCX (.docx)
  • For all other input formats, output format is the same as the input format

The EdgeTranslationFileResult object contains the following information:

Name Type Description
languagePairId string Language pair identifier
fileContent string Base64 string representing the translated file content.
requestId string Translation request identifier.

Browser JavaScript Environment

try {
    const clientConfiguration = new ClientConfiguration();
    clientConfiguration.credentialsConfiguration = new CredentialsConfiguration(clientId);
    const edgeLanguageWeaverClient = await new EdgeLanguageWeaverClient()
        .withConfigurations(clientConfiguration)
        .build();
    const request = new EdgeRetrieveFileRequest();
    request.requestId = "requestId";
    request.outputFormat = Format.PLAIN;
    const translateFileResult = await edgeLanguageWeaverClient.retrieveEdgeFileTranslation(request);
    console.log(translateFileResult.fileContent);
} catch (e) {
    console.log(e);
}

See the complete sample on GitHub.

The EdgeRetrieveFileRequest object contains the following information:

Name Type Mandatory Default value Description
requestId string yes Translation request identifier
outputFormat Format no Format of output document (see table of possible output formats)
Note
  • For image input formats, output format is PLAIN text (.txt)
  • For EML and MSG input formats, output format is PLAIN text (.txt)
  • For PDF input format, output format is DOCX (.docx)
  • For all other input formats, output format is the same as the input format

The EdgeTranslationFileResult object contains the following information:

Name Type Description
languagePairId string Language pair identifier
fileContent string Base64 string representing the translated file content.
requestId string Translation request identifier.

Content Insights

Create Content Insights For Existing Translations

The getEdgeContentInsightsForTranslations method from EdgeLanguageWeaverClient returns the content insights of an asynchronous translation job. The translation must have been successfully completed first.

try {
    const edgeLanguageWeaverClient = await new EdgeLanguageWeaverClient().build();
    const edgeContentInsightsRequest = new EdgeContentInsightsRequest();
    edgeContentInsightsRequest.translationId = "translationId";

    const contentInsightsResult = await edgeLanguageWeaverClient.getEdgeContentInsightsResultForTranslation(edgeContentInsightsRequest);
    console.log(contentInsightsResult);
} catch (e) {
    console.log(e);
}

See the complete samples on GitHub:

  • backend
  • browser
Note

When you perform content insights for existing translation, you need to disable "Content deletion" and enable "Content Insights" from your account settings

The EdgeContentInsightsRequest object contains the following information:

Name Type Description
translationId string Identifier of translation job

The EdgeContentInsightsResult object contains the following information:

Name Type Description
title string Title of the translation document
summarization EdgeSummarization Object containing the sentences from the input files that were selected as part of the summary

The EdgeSummarization object contains the following information:

Name Type Description
segments EdgeSegment array Summarized segments of the document

The EdgeSegment object contains the following information:

Name Type Description
text string Segment of the summarization entry

For more information about the API, access: Content Insights For Existing Translations .

Feedback Management

Get All Feedback

By using the getEdgeFeedback method from EdgeLanguageWeaverClient, the list of available feedback will be returned, corresponding to the given client identifier.

try {
    const edgeLanguageWeaverClient = await new EdgeLanguageWeaverClient().build();
    const filterRequest = new EdgeFilterFeedbackRequest();
    filterRequest.startDate = "10-04-2022";
    filterRequest.endDate = "10-24-2022";
    filterRequest.user = "user@mail.com";
    filterRequest.languagePairId = "EngFra_Generic_Cloud";
    filterRequest.sourceText = "This is a sample input text.";
    filterRequest.machineTranslation = "C'est un exemple de texte d'entrée.";
    filterRequest.suggestedTranslation = "Ceci est un exemple de texte d'entrée.";
    filterRequest.approvalStatuses = [ApprovalStatus.APPROVED, ApprovalStatus.REJECTED];
    filterRequest.reviewer = "user@mail.com";
    const feedbackResult = await edgeLanguageWeaverClient.getEdgeFeedback(1, 50, filterRequest);
    // handle result
} catch (e) {
    // handle errors
}

See the complete samples on GitHub:

  • backend
  • browser


The getEdgeFeedback method has the following parameters:

Name Type Mandatory Default Description
pageNumber number yes Number specifying the requested page number
pageSize number no 100 Number specifying the requested page size
filterRequest EdgeFilterFeedbackRequest no String specifying the criteria by which the returned feedback to be filtered

The EdgeFilterFeedbackRequest object contains the following information:

Name Type Mandatory Default Description
startDate string yes The start date for the filtered feedback
endDate string yes The end date for the filtered feedback
user string no The username of the user who created the feedback
languagePairId string no Language pair identifier. Cannot be used in combination with sourceLanguageId or targetLanguageId
sourceLanguageId string no Three letters language code of the source language
targetLanguageId string no Three letters language code of the target language
sourceText string no Text provided to be translated
machineTranslation string no Translation provided by machine translation
suggestedTranslation string no Expected translation
approvalStatuses ApprovalStatus[] no List of approval statuses (APPROVED, REJECTED, POOR)
reviewer string no The email of the user who reviewed the feedback

The EdgeFeedbackListResult object contains the following information:

Name Type Description
feedbackList EdgeFeedbackResult array Contains a list of EdgeFeedbackResult objects
pageNumber number Number specifying the requested page number
pageSize number Number specifying the requested page size
totalCount number Total number of feedback in account
totalPages number Total number of pages available

The EdgeFeedbackResult object contains the following information:

Name Type Description
feedbackId string Feedback identifier
languagePairId string Identifier of the language pair
sourceLanguageId string Three letters language code of the source language
targetLanguageId string Three letters language code of the target language
model string A string representing a unique identifier for the language pair combination sourceLanguageId-targetLanguageId-model. (e.g. generic)
sourceText string Text provided to be translated
targetText string Translation provided by machine translation
suggestedTranslation string Expected translation
approvalState ApprovalStatus The approval status of the feedback (APPROVED, REJECTED, PENDING)
feedbackAuditData AuditData An object representing the details about the lifecycle of the feedback
approvalAuditData AuditData An object representing the details about the lifecycle of the feedback approval status

The AuditData object contains the following information:

Name Type Description
createdByUserEmail string The email of the user who created the feedback
creationDate string Creation date of the feedback
lastModifiedByUserEmail string The email of the user who last modified the feedback
lastModifyDate string The date when the feedback was last modified

Create Feedback

The createEdgeFeedback method from EdgeLanguageWeaverClient can be used to add a new translation feedback.

try {
    const edgeLanguageWeaverClient = await new EdgeLanguageWeaverClient().build();
    const createRequest = new EdgeCreateFeedbackRequest();
    createRequest.languagePairId = "EngFra_Generic_Cloud";
    createRequest.model = "generic";
    createRequest.sourceText = "This is a sample input text.";
    createRequest.targetText = "C'est un exemple de texte d'entrée.";
    createRequest.suggestedTranslation = "Ceci est un exemple de texte d'entrée.";
    createRequest.approvalState = ApprovalStatus.APPROVED;
    const feedbackResult = await edgeLanguageWeaverClient.createEdgeFeedback(createRequest);
    // handle result
} catch (e) {
    // handle errors
}

See the complete samples on GitHub:

  • backend
  • browser


The EdgeCreateFeedbackRequest object contains the following information:

Name Type Mandatory Default Description
languagePairId string yes Identifier of the language pair
sourceLanguageId string yes* Three letters language code of the source language.
targetLanguageId string yes* Three letters language code of the target language.
model string yes* A string representing a unique identifier for the language pair combination sourceLanguageId-targetLanguageId-model. (e.g. generic)
sourceText string yes Text provided to be translated
targetText string yes Translation provided by machine translation
suggestedTranslation string yes Expected translation
Note
  • sourceLanguageId, targetLanguageId and model are mandatory only if languagePairId is not provided.

The EdgeFeedbackResult object contains the following information:

Name Type Description
feedbackId string Feedback identifier
languagePairId string Identifier of the language pair
sourceLanguageId string Three letters language code of the source language
targetLanguageId string Three letters language code of the target language
model string A string representing a unique identifier for the language pair combination sourceLanguageId-targetLanguageId-model. (e.g. generic)
sourceText string Text provided to be translated
targetText string Translation provided by machine translation
suggestedTranslation string Expected translation
approvalState ApprovalStatus The approval status of the feedback (APPROVED, REJECTED, PENDING)
feedbackAuditData AuditData An object representing the details about the lifecycle of the feedback
approvalAuditData AuditData An object representing the details about the lifecycle of the feedback approval status

The AuditData object contains the following information:

Name Type Description
createdByUserEmail string The email of the user who created the feedback
creationDate string Creation date of the feedback
lastModifiedByUserEmail string The email of the user who last modified the feedback
lastModifyDate string The date when the feedback was last modified

Update Feedback

The updateEdgeFeedback method from EdgeLanguageWeaverClient can be used to update an existing translation feedback.

try {
    const edgeLanguageWeaverClient = await new EdgeLanguageWeaverClient().build();
    const updateRequest = new EdgeUpdateFeedbackRequest();
    updateRequest.feedbackId = "e8b01170-1bc4-4d61-89f7-fc2f65733442";
    updateRequest.suggestedTranslation = "Ceci est un exemple de texte d'entrée.";
    updateRequest.approvalState = ApprovalStatus.PENDING;
    const feedbackResult = await edgeLanguageWeaverClient.updateEdgeFeedback(updateRequest);
    // handle result
} catch (e) {
    // handle errors
}

See the complete samples on GitHub:

  • backend
  • browser


The EdgeUpdateFeedbackRequest object contains the following information:

Name Type Mandatory Default Description
feedbackId string yes Feedback identifier
suggestedTranslation string no Expected translation
approvalState ApprovalStatus no The approval status of the feedback (APPROVED, REJECTED, PENDING)

The EdgeFeedbackResult object contains the following information:

Name Type Description
feedbackId string Feedback identifier
languagePairId string Identifier of the language pair
sourceLanguageId string Three letters language code of the source language
targetLanguageId string Three letters language code of the target language
model string A string representing a unique identifier for the language pair combination sourceLanguageId-targetLanguageId-model. (e.g. generic)
sourceText string Text provided to be translated
targetText string Translation provided by machine translation
suggestedTranslation string Expected translation
approvalState ApprovalStatus The approval status of the feedback (APPROVED, REJECTED, PENDING)
feedbackAuditData AuditData An object representing the details about the lifecycle of the feedback
approvalAuditData AuditData An object representing the details about the lifecycle of the feedback approval status

The AuditData object contains the following information:

Name Type Description
createdByUserEmail string The email of the user who created the feedback
creationDate string Creation date of the feedback
lastModifiedByUserEmail string The email of the user who last modified the feedback
lastModifyDate string The date when the feedback was last modified

Update Feedback Approval Status

The updateEdgeFeedbackApproval method from EdgeLanguageWeaverClient can be used to update the approval status of an existing translation feedback.

try {
    const edgeLanguageWeaverClient = await new EdgeLanguageWeaverClient().build();
    const updateRequest = new EdgeUpdateFeedbackApprovalRequest();
    updateRequest.feedbackId = "e8b01170-1bc4-4d61-89f7-fc2f65733442";
    updateRequest.approvalStatus = ApprovalStatus.APPROVED;
    const feedbackResult = await edgeLanguageWeaverClient.updateEdgeFeedbackApproval(updateRequest);
    // handle result
} catch (e) {
    // handle errors
}

See the complete samples on GitHub:

  • backend
  • browser


The EdgeUpdateFeedbackApprovalRequest object contains the following information:

Name Type Mandatory Default Description
feedbackId string yes Feedback identifier
approvalStatus ApprovalStatus yes The approval status of the feedback (APPROVED, REJECTED, PENDING)

The EdgeFeedbackResult object contains the following information:

Name Type Description
feedbackId string Feedback identifier
languagePairId string Identifier of the language pair
sourceLanguageId string Three letters language code of the source language
targetLanguageId string Three letters language code of the target language
model string A string representing a unique identifier for the language pair combination sourceLanguageId-targetLanguageId-model. (e.g. generic)
sourceText string Text provided to be translated
targetText string Translation provided by machine translation
suggestedTranslation string Expected translation
approvalState ApprovalStatus The approval status of the feedback (APPROVED, REJECTED, PENDING)
feedbackAuditData AuditData An object representing the details about the lifecycle of the feedback
approvalAuditData AuditData An object representing the details about the lifecycle of the feedback approval status

The AuditData object contains the following information:

Name Type Description
createdByUserEmail string The email of the user who created the feedback
creationDate string Creation date of the feedback
lastModifiedByUserEmail string The email of the user who last modified the feedback
lastModifyDate string The date when the feedback was last modified

Delete Feedback

The deleteEdgeFeedback method from EdgeLanguageWeaverClient can be used to delete an existing translation feedback.

try {
    const edgeLanguageWeaverClient = await new EdgeLanguageWeaverClient().build();
    const deleteRequest = new EdgeDeleteFeedbackRequest();
    deleteRequest.feedbackId = "e8b01170-1bc4-4d61-89f7-fc2f65733442";
    await edgeLanguageWeaverClient.deleteEdgeFeedback(deleteRequest);
} catch (e) {
    // handle errors
}

See the complete samples on GitHub:

  • backend
  • browser


The DeleteFeedbackRequest object contains the following information:

Name Type Mandatory Default Description
feedbackId string yes Feedback identifier

Input Formats

Language Weaver Edge supports the following input formats:

XML Formats

MIME Type File Extensions Description
text/html .htm, .html, .xhtml HTML
text/xml .xml XML
text/x-sdl-strict-xml .sdlxml XML with strict segmentation after each XML tag
text/x-tmx .tmx Translation Memory eXchange (TMX)
application/x-xliff .xliff XML Localization Interchange File Format v1.x (XLIFF)
application/xliff .xliff XML Localization Interchange File Format v2.x (XLIFF)

Text Formats

MIME Type File Extensions Description
text/plain .txt Plain text
text/x-line .xline Plain text, one sentence per line

Image Formats

MIME Type File Extensions Description
image/gif .gif Graphics Interchange Format (GIF)
image/jpeg .jpg, .jpeg JPEG
image/png .png Portable Network Graphics (PNG)
image/tiff .tiff, .tif Tagged Image File Format (TIFF)

Email Formats

MIME Type File Extensions Description
application/vnd.ms-outlook .msg Microsoft Outlook Email Message
message/rfc822 .eml Message (RFC 822)

Rich Formats

MIME Type File Extensions Description
application/pdf .pdf Adobe Acrobat (PDF)
application/rtf .rtf Rich Text Format (RTF)
application/vnd.openxmlformats-officedocument.wordprocessingml.document .docx, .dotx, .docm, .dotm Microsoft Word (Office Open XML)
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet .xlsx, .xltx, .xlsm, .xltm, .xlam Microsoft Excel (Office Open XML)
application/vnd.openxmlformats-officedocument.presentationml.presentation .pptx, .potx, .ppsx, .ppam, .pptm, .potm, .ppsm Microsoft PowerPoint (Office Open XML)
application/msword .doc, .dot Microsoft Word (97-2003)
application/vnd.ms-excel .xls, .xlt, .xla, .xlsb Microsoft Excel (97-2003)
application/vnd.ms-powerpoint .ppt, .pot, .pps, .ppa Microsoft PowerPoint (97-2003)
application/vnd.oasis.opendocument.text .odt OpenDocument Text
application/vnd.oasis.opendocument.spreadsheet .ods OpenDocument Spreadsheet
application/vnd.oasis.opendocument.presentation .odp OpenDocument Presentation
application/x-wps-writer .wps WPS Writer
application/x-wps-spreadsheet .et WPS Spreadsheet
application/x-wps-presentation .dps WPS Presentation

Output Formats

MIME Type Description
default or empty Default output:
- For image, audio and email input formats, output format is text/plain
- For application/pdf input, output format is text/plain if it is an image-only PDF, otherwise output format is application/vnd.openxmlformats-officedocument.wordprocessingml.document
- For all other input formats, output format is the same as the input format.
text/plain Plain text
application/x-xliff XML Localization Interchange File Format (v1.2)
application/xliff XML Localization Interchange File Format (v2.1)
text/x-tmx Translation Memory eXchange

Encodings

Language Weaver Edge supports the following character encodings for source documents:

Encoding
Big5
EUC-JP
EUC-KR
GB18030
IBM420_ltr
IBM420_rtl
IBM424_ltr
IBM424_rtl
ISO-2022-CN
ISO-2022-JP
ISO-2022-KR
ISO-8859-1
ISO-8859-2
ISO-8859-5
ISO-8859-6
ISO-8859-7
ISO-8859-8
ISO-8859-8-I
ISO-8859-9
KOI8-R
Shift_JIS
UTF-16BE
UTF-16LE
UTF-32BE
UTF-32LE
UTF-8
windows-1251
windows-1255
windows-1256

In addition to the encodings above, ‘Auto’ may be specified to allow automatic detection.

In this page
Back to top