Class: MockTranslationProvider

Class: MockTranslationProvider

QuickNav

MockTranslationProvider

new MockTranslationProvider()

Implementation of calls to the Translation Provider interface for the "MockServer".
You will need to create the corresponding implementation for your Language Service Provider.
Source:

Extends

Methods

addBinaryFile(projectId, authToken, binaryFileSpec, file, sourceLocale, additionalData) → {Promise.<object>}

Import a binary file into the Language Service Provider.
Parameters:
Name Type Description
projectId string Identifier of the project that will include the document.
authToken string Authorization header token to include in the request.
binaryFileSpec string file spec of the binary file.
file object file object of the binary file.
sourceLocale string The source locale for the document.
additionalData string Additional data to apply on each document.
Overrides:
Source:
Returns:
The response from the Language Service Provider.
Type
Promise.<object>

addDocument(projectId, authToken, name, content, sourceLocale, additionalData) → {Promise.<object>}

Import a document into the Language Service Provider.
Parameters:
Name Type Description
projectId string Identifier of the project that will include the document.
authToken string Authorization header token to include in the request.
name string Name of the document.
content string JSON content of the document.
sourceLocale string The source locale for the document.
additionalData string Additional data to apply on each document.
Overrides:
Source:
Returns:
The response from the Language Service Provider.
Type
Promise.<object>

addProject(authToken, communityId, workflowId, projectName) → {Promise.<string>}

Create a new project in the Language Service Provider.
Parameters:
Name Type Description
authToken string Authorization header token to include in the request.
communityId string Community identifier that should contain the project.
workflowId string Identifier of the Language Service Provider workflow to use to translate any documents.
projectName string Name of project to create.
Overrides:
Source:
Returns:
The Language Service Provider string id for the created project.
Type
Promise.<string>

addTranslation(authToken, projectId, id, locale) → {Promise.<object>}

Request the document be translated into the given locale.
Parameters:
Name Type Description
authToken string Authorization header token to include in the request.
projectId string Identifier of the project that will include the document.
id string Language Service Provider identifier for the document.
locale string Name of the locale to check.
Overrides:
Source:
Returns:
The Language Service Provider POST "/:id/translation" response.
Type
Promise.<object>

getBinaryTranslation(authToken, id, locale) → {Promise.<object>}

Get the translation of the binary for the given locale.
Parameters:
Name Type Description
authToken string Authorization header token to include in the request.
id string Language Service Provider identifier for the document.
locale string Name of the locale to check.
Overrides:
Source:
Returns:
The Language Service Provider GET "/:documentId/binarytranslation/:locale" response.
Type
Promise.<object>

getCommunity(authToken) → {Promise.<object>}

Get the details about the community for this user.
Parameters:
Name Type Description
authToken string Authorization header token to include in the request.
Overrides:
Source:
Returns:
The Language Service Provider GET "/community" response.
Type
Promise.<object>

getDocument(authToken, id) → {Promise.<string>}

Get the document identified by the Language service provider Id
Parameters:
Name Type Description
authToken string Authorization header token to include in the request.
id string Language Service Provider identifier for the document.
Overrides:
Source:
Returns:
The content of the document.
Type
Promise.<string>

getDocumentImportProcess(authToken, id) → {Promise.<object>}

Get the document import process identified by the Language service provider Id
Parameters:
Name Type Description
authToken string Authorization header token to include in the request.
id string Language Service Provider identifier for the document.
Overrides:
Source:
Returns:
The Language Service Provider GET "/:documentId/import-process" response.
Type
Promise.<object>

getDocumentTranslationStatus(authToken, id, locale) → {Promise.<object>}

Get the status of the specified locale of the document in the Language Service Provider.
Parameters:
Name Type Description
authToken string Authorization header token to include in the request.
id string Language Service Provider identifier for the document.
locale string Name of the locale to check.
Overrides:
Source:
Returns:
The Language Service Provider GET "/:id/translation" response specific for the requested locale.
Type
Promise.<object>

getDocumentTranslationStatuses(authToken, id) → {Promise.<object>}

Get the statuses of all the locales of the document in the Language Service Provider.
Parameters:
Name Type Description
authToken string Authorization header token to include in the request.
id string Language Service Provider identifier for the document.
Overrides:
Source:
Returns:
The Language Service Provider GET "/:id/translation" response.
Type
Promise.<object>

getProjectStatus(authToken, id) → {Promise.<string>}

Get the percent complete of the project.
This represents the percentage complete of the translations for all the documents in the project.
Parameters:
Name Type Description
authToken string Authorization header token to include in the request.
id string Language Service Provider identifier for the document.
Overrides:
Source:
Returns:
The Language Service Provider GET "/:id/status" response.
Type
Promise.<string>

getTranslation(authToken, id, locale) → {Promise.<string>}

Get the translation of the document for the given locale.
Parameters:
Name Type Description
authToken string Authorization header token to include in the request.
id string Language Service Provider identifier for the document.
locale string Name of the locale to check.
Overrides:
Source:
Returns:
The Language Service Provider GET "/:id/translation/:locale" response.
Type
Promise.<string>