New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

g11n-pipeline

Package Overview
Dependencies
Maintainers
1
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

g11n-pipeline

JavaScript (Node.js, etc) client for Bluemix Globalization Pipeline

  • 2.0.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
11K
decreased by-7.17%
Maintainers
1
Weekly downloads
 
Created
Source

Globalization Pipeline Client for JavaScript

This is the JavaScript SDK for the Globalization Pipeline Bluemix service. The Globalization Pipeline service makes it easy for you to provide your global customers with Bluemix applications translated into the languages in which they work. This SDK currently supports:

npm version Build Status Coverage Status Coverity Status

News

Sample

For a working Bluemix application sample, see gp-nodejs-sample.

Quickstart

  • You should familiarize yourself with the service itself. A good place to begin is by reading the Quick Start Guide and the official Getting Started with IBM Globalization documentation. The documentation explains how to find the service on Bluemix, create a new service instance, create a new bundle, and access the translated messages.

  • Next, add g11n-pipeline to your project, as well as cfenv and optional.

    npm install --save g11n-pipeline cfenv optional

  • Load the client object as follows (using cfenv ).

var optional = require('optional');
var appEnv = require('cfenv').getAppEnv();
var gpClient = require('g11n-pipeline').getClient(
  optional('./local-credentials.json')   // if it exists, use local-credentials.json
    || {appEnv: appEnv}                  // otherwise, the appEnv
);
  • For local testing, create a local-credentials.json file with the credentials as given in the bound service:

    {
      "credentials": {
        "url": "https://…",
        "userId": "…",
        "password": "……",
        "instanceId": "………"
      }
    }
    

Using

To fetch the strings for a bundle named "hello", first create a bundle accessor:

    var mybundle = gpClient.bundle('hello');

Then, call the getStrings function with a callback:

    mybundle.getStrings({ languageId: 'es'}, function (err, result) {
        if (err) {
            // handle err..
            console.error(err);
        } else {
            var myStrings = result.resourceStrings;
            console.dir(myStrings);
        }
    });

This code snippet will output the translated strings such as the following:

    {
        hello:   '¡Hola!',
        goodbye: '¡Adiós!',
        …
    }

Translation Requests

To create a Translation request:

    gpClient.tr({
      name: 'My first TR',
      domains: [ 'HEALTHC' ],

      emails: ['my_real_email@me.example.com'],
      partner: 'IBM',
      targetLanguagesByBundle: {
          bundle1: [ 'es', 'fr', 'de' ], // review bundle1’s Spanish, etc… 
          bundle2: [ 'zh-Hans' ]   // review bundle2’s Simplified Chinese…
      },
      notes: [ 'This is a mobile health advice application.' ],
      status: 'SUBMITTED' // request to submit it right away.
    })
    .create((err, tr) => {
        if(err) { … handle err … }

        console.log('TR submitted with ID:', tr.id);
        console.log('Estimated completion:', 
            tr.estimatedCompletion.toLocaleString());
    });

To then check on the status of that request:

    gpClient.tr('333cfaecabdedbd8fa16a24b626848d6')
    .getInfo((err, tr) => {
        if(err) { … handle err … }

        console.log('Current status:', tr.status);
    });

Async

Note that all calls that take a callback are asynchronous. For example, the following code:

var bundle = client.bundle('someBundle');
bundle.create({…}, function(){…});
bundle.uploadStrings({…}, function(){…});

…will fail, because the bundle someBundle hasn’t been created by the time the uploadStrings call is made. Instead, make the uploadStrings call within a callback:

var bundle = client.bundle('someBundle');
bundle.create({…}, function(){
    …
    bundle.uploadStrings({…}, function(){…});
});

Testing

See TESTING.md

Browserify

The gp-js-client can be used in a web browser via browserify.

You can call the g11n-pipeline API just as from Node.js:

// mycode.js
const gp = require('g11n-pipeline');
gp.getClient({/*...*/}) // do some great stuff here

And then, package up the code for the browser:

npm i --save g11n-pipeline
npm i -g browserify
browserify mycode.js > bundle.js

Finally, include the bundle in your HTML:

<script src="./bundle.js"></script>

API convention

APIs may take a callback OR return a promise, and use this general pattern

Promise mode

  • ⚠ _please note that the apidocs haven’t been updated yet to note that the callback cb is optional and that Promises are returned by most functions.
    gpClient.function( { /* opts */ })
    .then( result => /* do something with result */)
    .catch( err => /* do something with err */ );
  • opts: an object containing input parameters, if needed.

Callback mode

Prior to v2.0, only the callback model was supported. This is still supported.

    gpClient.function( { /*opts*/ } ,  function callback(err, result))
  • opts: an object containing input parameters, if needed.
  • callback: a callback with:
    • err: if truthy, indicates an error has occured. -result: the operation’s result

Sometimes the opts object is optional. If this is the case, the API doc will indicate it with this notation: [opts] For example, bundle.getInfo(cb) and bundle.getInfo({}, cb) are equivalent.

Also, note that there are aliases from the swagger doc function names to the convenience name. For example, bundle.uploadResourceStrings can be used in place of bundle.uploadStrings.

All language identifiers are IETF BCP47 codes.

API reference

Classes

Bundle

Accessor object for a Globalization Pipeline bundle

Client

Client object for Globalization Pipeline

ResourceEntry

Globalization Pipeline individual resource entry accessor

TranslationRequest
User

Globalization Pipeline user access object

Members

serviceRegex

a Regex for matching the service. Usage: var credentials = require('cfEnv') .getAppEnv().getServiceCreds(gp.serviceRegex); (except that it needs to match by label)

exampleCredentials

Example credentials such as for documentation.

exampleCredentialsString

Example credentials string

version

Current version

Functions

getClient(params)Client

Construct a g11n-pipeline client. params.credentials is required unless params.appEnv is supplied.

Typedefs

ExternalService : Object

info about external services available

basicCallback : function

Basic Callback used throughout the SDK

WordCountsInfo : object

Bundle

Accessor object for a Globalization Pipeline bundle

Kind: global class
Properties

NameTypeDescription
updatedBystringuserid that updated this bundle
updatedAtDatedate when the bundle was last updated
sourceLanguagestringbcp47 id of the source language
targetLanguagesArray.<string>array of target langauge bcp47 ids
readOnlybooleantrue if this bundle can only be read
metadataObject.<string, string>array of user-editable metadata

new Bundle(gp, props)

Note: this constructor is not usually called directly, use Client.bundle(id)

ParamTypeDescription
gpClientparent g11n-pipeline client object
propsObjectproperties to inherit

bundle.getInfoFields

List of fields usable with Bundle.getInfo()

Kind: instance property of Bundle

bundle.delete([opts], cb)

Delete this bundle.

Kind: instance method of Bundle

ParamTypeDefaultDescription
[opts]Object{}options
cbbasicCallback

bundle.create(body, cb)

Create this bundle with the specified params. Note that on failure, such as an illegal language being specified, the bundle is not created.

Kind: instance method of Bundle

ParamTypeDescription
bodyObject
body.sourceLanguagestringbcp47 id of source language such as 'en'
body.targetLanguagesArrayoptional array of target languages
body.metadataObjectoptional metadata for the bundle
body.partnerstringoptional ID of partner assigned to translate this bundle
body.notesArray.<string>optional note to translators
cbbasicCallback

bundle.getInfo([opts], cb)

Get bundle info. Returns a new Bundle object with additional fields populated.

Kind: instance method of Bundle

ParamTypeDefaultDescription
[opts]Object{}Options object
opts.fieldsStringComma separated list of fields
opts.translationStatusMetricsByLanguageBooleanOptional field (false by default)
opts.reviewStatusMetricsByLanguageBooleanOptional field (false by default)
opts.partnerStatusMetricsByLanguageBooleanOptional field (false by default)
cbgetInfoCallbackcallback (err, Bundle )

bundle.languages() ⇒ Array.<String>

Return all of the languages (source and target) for this bundle. The source language will be the first element. Will return undefined if this bundle was not returned by getInfo().

Kind: instance method of Bundle

bundle.getStrings(opts, cb)

Fetch one language's strings

Kind: instance method of Bundle

ParamTypeDefaultDescription
optsObjectoptions
opts.languageIdStringlanguage to fetch
[opts.fallback]booleanfalseWhether if source language value is used if translated value is not available
[opts.fields]stringOptional fields separated by comma
cbbasicCallbackcallback (err, { resourceStrings: { strings… } })

bundle.entry(opts)

Create an entry object. Doesn't fetch data,

Kind: instance method of Bundle
See: ResourceEntry~getInfo

ParamTypeDescription
optsObjectoptions
opts.languageIdStringlanguage
opts.resourceKeyStringresource key

bundle.entries(opts, cb)

List entries. Callback is called with a map of resourceKey to ResourceEntry objects.

Kind: instance method of Bundle

ParamTypeDescription
optsObjectoptions
opts.languageIdStringlanguage to fetch
cblistEntriesCallbackCallback with (err, map of resourceKey:ResourceEntry )

bundle.uploadStrings(opts, cb)

Upload resource strings, replacing all current contents for the language

Kind: instance method of Bundle

ParamTypeDescription
optsObjectoptions
opts.languageIdStringlanguage to update
opts.stringsObject.<string, string>strings to update
cbbasicCallback

bundle.update(opts, cb)

Kind: instance method of Bundle

ParamTypeDescription
optsObjectoptions
opts.targetLanguagesarrayoptional: list of target languages to update
opts.readOnlybooleanoptional: set this bundle to be readonly or not
opts.metadataobjectoptional: metadata to update
opts.partnerstringoptional: partner id to update
opts.notesArray.<string>optional notes to translator
cbbasicCallbackcallback

bundle.updateStrings(opts, cb)

Update some strings in a language.

Kind: instance method of Bundle

ParamTypeDescription
optsObjectoptions
opts.stringsObject.<string, string>strings to update.
opts.languageIdStringlanguage to update
opts.resyncBooleanoptional: If true, resynchronize strings in the target language and resubmit previously-failing translation operations
cbbasicCallback

Bundle~getInfoCallback : function

Callback returned by Bundle~getInfo().

Kind: inner typedef of Bundle

ParamTypeDescription
errobjecterror, or null
bundleBundlebundle object with additional data
bundle.updatedBystringuserid that updated this bundle
bundle.updatedAtDatedate when the bundle was last updated
bundle.sourceLanguagestringbcp47 id of the source language
bundle.targetLanguagesArray.<string>array of target langauge bcp47 ids
bundle.readOnlybooleantrue if this bundle can only be read
bundle.metadataObject.<string, string>array of user-editable metadata
bundle.translationStatusMetricsByLanguageObjectadditional metrics information
bundle.reviewStatusMetricsByLanguageObjectadditional metrics information

Bundle~listEntriesCallback : function

Called by entries()

Kind: inner typedef of Bundle

ParamTypeDescription
errobjecterror, or null
entriesObject.<string, ResourceEntry>map from resource key to ResourceEntry object. The .value field will be filled in with the string value.

Client

Client object for Globalization Pipeline

Kind: global class

client.version

Version number of the REST service used. Currently ‘V2’.

Kind: instance property of Client

client.url ⇒ String

Return the URL used for this client.

Kind: instance property of Client
Returns: String - - the URL

client.supportedTranslations([opts], cb)

This function returns a map from source language(s) to target language(s). Example: { en: ['de', 'ja']} meaning English translates to German and Japanese.

Kind: instance method of Client

ParamTypeDefaultDescription
[opts]object{}ignored
cbsupportedTranslationsCallback(err, map-of-languages)

client.getServiceInfo([opts], cb)

Get global information about this service, not specific to one service instance.

Kind: instance method of Client

ParamTypeDefaultDescription
[opts]object{}ignored argument
cbserviceInfoCallback

client.getServiceInstanceInfo([opts], cb)

Get information about our specific service instance.

Kind: instance method of Client

ParamTypeDefaultDescription
[opts]object{}options
[opts.serviceInstance]stringrequest a specific service instance’s info
cbserviceInstanceInfoCallback

client.ping(args, cb)

Verify that there is access to the server. An error result will be returned if there is a problem. On success, the data returned can be ignored. (Note: this is a synonym for getServiceInfo())

Kind: instance method of Client

ParamTypeDescription
argsobject(ignored)
cbbasicCallback

client.createUser(opts, cb)

Create a user

Kind: instance method of Client

ParamTypeDescription
optsobject
opts.typestringUser type (ADMINISTRATOR, TRANSLATOR, or READER)
opts.displayNamestringOptional display name for the user. This can be any string and is displayed in the service dashboard.
opts.commentstringOptional comment
opts.bundlesArrayset of accessible bundle ids. Use ['*'] for “all bundles”
opts.metadataObject.<string, string>optional key/value pairs for user metadata
opts.externalIdstringoptional external user ID for your application’s use
cbgetUserCallbackpassed a new User object

client.user(id) ⇒ User

Create a user access object. This doesn’t create the user itself, nor query the server, but is just a handle object. Use createUser() to create a user.

Kind: instance method of Client

ParamTypeDescription
idObjectString (id) or map {id: bundleId, serviceInstance: serviceInstanceId}

client.users([opts], cb)

List users. Callback is called with an array of user access objects.

Kind: instance method of Client

ParamTypeDefaultDescription
[opts]Object{}options
cblistUsersCallbackcallback

client.bundles([opts], cb)

List bundles. Callback is called with an map of bundle access objects.

Kind: instance method of Client

ParamTypeDefaultDescription
[opts]Object{}options
cblistBundlesCallbackgiven a map of Bundle objects

client.bundle(opts) ⇒ Bundle

Create a bundle access object. This doesn’t create the bundle itself, just a handle object. Call create() on the bundle to create it.

Kind: instance method of Client

ParamTypeDescription
optsObjectString (id) or map {id: bundleId, serviceInstance: serviceInstanceId}

client.tr(opts) ⇒ TranslationRequest

Create a Translation Request access object. This doesn’t create the TR itself, just a handle object. Call create() on the translation request to create it.

Kind: instance method of Client

ParamTypeDescription
optsstring | Object.<string, Object>Can be a string (id) or map with values (for a new TR). See TranslationRequest.

client.trs([opts], cb)

List Translation Requests. Callback is called with an map of TR access objects.

Kind: instance method of Client

ParamTypeDefaultDescription
[opts]Object{}optional map of options
cbgetTranslationRequestsCallbackcallback yielding a map of Translation Requests

Client~supportedTranslationsCallback : function

Callback returned by supportedTranslations()

Kind: inner typedef of Client

ParamTypeDescription
errobjecterror, or null
languagesObject.<string, Array.<string>>map from source language to array of target languages Example: { en: ['de', 'ja']} meaning English translates to German and Japanese.

Client~serviceInfoCallback : function

Callback used by getServiceInfo()

Kind: inner typedef of Client

ParamTypeDescription
errobjecterror, or null
infoObjectdetailed information about the service
info.supportedTranslationObject.<string, Array.<string>>map from source language to array of target languages Example: { en: ['de', 'ja']} meaning English translates to German and Japanese.
info.supportedHumanTranslationObject.<string, Array.<string>>map from source language to array of target languages supported for human translation. Example: { en: ['de', 'ja']} meaning English translates to German and Japanese.
info.externalServicesArray.<ExternalService>info about external services available

Client~serviceInstanceInfoCallback : function

Callback returned by getServiceInstanceInfo()

Kind: inner typedef of Client

ParamTypeDescription
errobjecterror, or null
instanceInfoobjectAdditional information about the service instance
instanceInfo.updatedBystringinformation about how our service instance was updated
instanceInfo.updatedAtdatewhen the instance was last updated
instanceInfo.regionstringthe Bluemix region name
instanceInfo.cfServiceInstanceIdstringthe CloudFoundry service instance ID
instanceInfo.serviceIdstringthis is equivalent to the service instance ID
instanceInfo.orgIdstringthis is the Bluemix organization ID
instanceInfo.spaceIdstringthis is the Bluemix space ID
instanceInfo.planIdstringthis is the Bluemix plan ID
instanceInfo.htServiceEnabledbooleantrue if the Human Translation service is enabled
instanceInfo.usageobjectusage information
instanceInfo.usage.sizenumberthe size of resource data used by the Globalization Pipeline instance in bytes
instanceInfo.disabledbooleantrue if this service has been set as disabled by Bluemix

Client~listUsersCallback : function

Called by users()

Kind: inner typedef of Client
See: User

ParamTypeDescription
errobjecterror, or null
usersObject.<string, User>map from user ID to User object

Client~listBundlesCallback : function

Bundle list callback

Kind: inner typedef of Client

ParamTypeDescription
errobjecterror, or null
bundlesObject.<string, Bundle>map from bundle ID to Bundle object

ResourceEntry

Globalization Pipeline individual resource entry accessor

Kind: global class
See: Bundle~entries
Properties

NameTypeDescription
resourceKeyStringkey for the resource
updatedBystringthe user which last updated this entry
updatedAtDatewhen this entry was updated
valuestringthe translated value of this entry
sourceValuestringthe source value of this entry
reviewedbooleanindicator of whether this entry has been reviewed
translationStatusstringstatus of this translation: source_language, translated, in_progress, or failed
entry.metadataObject.<string, string>user metadata for this entry
partnerStatusstringstatus of partner integration
sequenceNumbernumberrelative sequence of this entry
notesArray.<string>optional notes to translator

resourceEntry.getInfo([opts], cb)

Load this entry's information. Callback is given another ResourceEntry but one with all current data filled in.

Kind: instance method of ResourceEntry

ParamTypeDefaultDescription
[opts]Object{}options
cbgetInfoCallbackcallback (err, ResourceEntry)

resourceEntry.update()

Update this resource entry's fields.

Kind: instance method of ResourceEntry

ParamTypeDescription
opts.valuestringstring value to update
opts.reviewedbooleanoptional boolean indicating if value was reviewed
opts.metadataobjectoptional metadata to update
opts.notesArray.<string>optional notes to translator
opts.partnerStatusstringtranslation status maintained by partner
opts.sequenceNumberstringsequence number of the entry (only for the source language)

ResourceEntry~getInfoCallback : function

Callback called by ResourceEntry~getInfo()

Kind: inner typedef of ResourceEntry

ParamTypeDescription
errobjecterror, or null
entryResourceEntryOn success, the new or updated ResourceEntry object.

TranslationRequest

Kind: global class
Properties

NameTypeDefaultDescription
idstringTranslation Request ID
serviceInstancestringthe Service Instance that this Translation Request belongs to
partnerstringthe three letter Partner ID to be used. Use 'IBM' for the Professional Plan
namestringdescriptive title for this translation request
targetLanguagesByBundleObject.<String, Array.<String>>map from Bundle ID to array of target languages
emailsArray.<String>array of email addresses for the requester
domainsArray.<TranslationDomain>A list of applicable translation domains.
statusTranslationRequestStatusStatus of this TR.
wordCountsByBundleObject.<String, WordCountsInfo>map of bundle IDs to word count data
updatedBystringlast updated user ID
updatedAtDatedate when the TR was updated
createdAtDatedate when the TR was first submitted
estimatedCompletionDatedate when the TR is expected to be complete
startedAtDatedate when the TR was accepted for processing
translatedAtDatedate when the TR had completed translation review
mergedAtDatedate when the TR was merged back into the target bundles
notesArray.<String>[]optional array of notes to the translators
metadataObject.<string, string>array of user-defined metadata

new TranslationRequest(gp, props)

This class represents a request for professional editing of machine-translated content. Note: this constructor is not usually called directly, use Client.tr(id) or Client.tr({fields…})

ParamTypeDescription
gpClientparent g11n-pipeline client object
propsObjectproperties to inherit

translationRequest.getInfo([opts], cb)

Fetch the full record for this translation request. Example: client.tr('1dec633b').getInfo((err, tr) => { console.log(tr.status); });

Kind: instance method of TranslationRequest

ParamTypeDefaultDescription
[opts]Object{}Options object - if present, overrides values in this
cbgetTranslationRequestCallback

translationRequest.delete([opts], cb)

Delete this translation request.

Kind: instance method of TranslationRequest

ParamTypeDefaultDescription
[opts]Object{}Options object - if present, overrides values in this
cbBasicCallBack

translationRequest.create([opts], cb)

Create a translation request with the specified options. The callback returns a new TranslationRequest object with the id and other fields populated. Example: client.tr({ status: 'SUBMITTED', ... }).create((err, tr) => { console.log(tr.id); });

Kind: instance method of TranslationRequest

ParamTypeDefaultDescription
[opts]Object{}Options object - if present, overrides values in this
cbgetTranslationRequestCallback

translationRequest.update(opts, cb)

Update a translation request with the specified values. If any property of opts is missing, that value will not be updated.

Kind: instance method of TranslationRequest

ParamTypeDescription
optsObjectOptions object - contains fields to update
[opts.partner]Stringoptional: update partner.
[opts.name]Stringoptional: update name
[opts.targetLanguagesByBundle]Object.<String, Array.<String>>optional: update target bundle/language list
[opts.emails]Array.<String>optional: update email list
[opts.domains]Array.<TranslationDomain>optional: update domain list
[opts.status]TranslationRequestStatusoptional: update TR status. May only change from DRAFT to SUBMITTED here.
[opts.metadata]Object.<String, String>optional: update metadata
cbbasicCallbackcallback with update status

TranslationRequest~getTranslationRequestsCallback : function

Callback returned by trs()

Kind: inner typedef of TranslationRequest

ParamTypeDescription
errObjecterror, or null
trsObject.<string, TranslationRequest>map from translation request ID to TranslationRequest Example: { 1dec633b: {…}} if there was just one TR, id 1dec633b

TranslationRequest~getTranslationRequestCallback : function

Callback returned by getInfo and create

Kind: inner typedef of TranslationRequest

ParamTypeDescription
errObjecterror, or null
trTranslationRequestthe returned TranslationRequest

User

Globalization Pipeline user access object

Kind: global class
Properties

NameTypeDescription
idStringthe userid
updatedByStringgives information about which user updated this user last
updatedAtDatethe date when the item was updated
typeStringADMINISTRATOR, TRANSLATOR, or READER
displayNameStringoptional human friendly name
metadataObject.<string, string>optional user-defined data
serviceManagedBooleanif true, the GP service is managing this user
passwordStringuser password
commentStringoptional user comment
externalIdStringoptional User ID used by another system associated with this user
bundlesArray.<string>list of bundles managed by this user

new User(gp, props)

Note: this constructor is not usually called directly, use Client.user(id)

ParamTypeDescription
gpClientparent Client object
propsObjectproperties to inherit

user.update(opts, cb)

Update this user. All fields of opts are optional. For strings, falsy = no change, empty string '' = deletion.

Kind: instance method of User

ParamTypeDescription
optsobjectoptions
opts.displayNamestringUser's display name - falsy = no change, empty string '' = deletion.
opts.commentstringoptional comment - falsy = no change, empty string '' = deletion.
opts.bundlesArray.<string>Accessible bundle IDs.
opts.metadataobject.<string, string>User defined user metadata containg key/value pairs. Data will be merged in. Pass in {} to erase all metadata.
opts.externalIdstringUser ID used by another system associated with this user - falsy = no change, empty string '' = deletion.
cbbasicCallbackcallback with success or failure

user.delete([opts], cb)

Delete this user. Note that the service managed user (the initial users created by the service) may not be deleted.

Kind: instance method of User

ParamTypeDefaultDescription
[opts]Object{}options
cbbasicCallbackcallback with success or failure

user.getInfo(opts, cb)

Fetch user info. The callback is given a new User instance, with all properties filled in.

Kind: instance method of User

ParamTypeDescription
optsObjectoptional, ignored
cbgetUserCallbackcalled with updated info

User~getUserCallback : function

Callback called by ClientcreateUser() and UsergetInfo()

Kind: inner typedef of User

ParamTypeDescription
errobjecterror, or null
userUserOn success, the new or updated User object.

serviceRegex

a Regex for matching the service. Usage: var credentials = require('cfEnv') .getAppEnv().getServiceCreds(gp.serviceRegex); (except that it needs to match by label)

Kind: global variable
Properties

Name
serviceRegex

exampleCredentials

Example credentials such as for documentation.

Kind: global variable
Properties

Name
exampleCredentials

exampleCredentialsString

Example credentials string

Kind: global variable
Properties

Name
exampleCredentialsString

version

Current version

Kind: global variable

TranslationRequestStatus : enum

Possible status values for Translation Requests

Kind: global enum
Properties

NameTypeDescription
DRAFTstringThe translation request has not been submitted for processing. It may modified or cancelled.
SUBMITTEDstringThe translation request has been submitted for processing, but has not been accepted by the partner yet.
STARTEDstringWork has started on the translation request.
TRANSLATEDstringAll work has been completed on the translation request. It has not been merged into the target resource data yet.
MERGEDstringThe translation results have been merged into the original resource bundles.

TranslationDomain : enum

Possible translation domains. These provide hints as to the type of translation expected.

Kind: global enum
Properties

NameTypeDefault
AEROMILstring"Aerospace and the military-industrial complex"
CNSTRCTstring"Construction"
GDSSVCSstring"Goods and service"
EDUCATNstring"Education"
FINSVCSstring"Financial Services"
GOVPUBLstring"Government and public sector"
HEALTHCstring"Healthcare and social services"
INDSTMFstring"Industrial manufacturing"
TELECOMstring"Telecommunication"
DMEDENTstring"Digital media and entertainment"
INFTECHstring"Information technology"
TRVLTRSstring"Travel and transportation"
INSURNCstring"Insurance"
ENGYUTLstring"Energy and utilities"
AGRICLTstring"Agriculture"

getClient(params) ⇒ Client

Construct a g11n-pipeline client. params.credentials is required unless params.appEnv is supplied.

Kind: global function

ParamTypeDescription
paramsObjectconfiguration params
params.appEnvObjectpass the result of cfEnv.getAppEnv(). Ignored if params.credentials is supplied.
params.credentialsObject.<string, string>Bound credentials as from the CF service broker (overrides appEnv)
params.credentials.urlstringservice URL. (should end in '/translate')
params.credentials.userIdstringservice API key.
params.credentials.passwordstringservice API key.
params.credentials.instanceIdstringinstance ID

ExternalService : Object

info about external services available

Kind: global typedef
Properties

NameTypeDescription
typestringThe type of the service, such as MT for Machine Translation
namestringThe name of the service
idstringThe id of the service
supportedTranslationObject.<string, Array.<string>>map from source language to array of target languages Example: { en: ['de', 'ja']} meaning English translates to German and Japanese.

basicCallback : function

Basic Callback used throughout the SDK

Kind: global typedef

ParamTypeDescription
errObjecterror, or null
dataObjectReturned data

WordCountsInfo : object

Kind: global typedef
Properties

NameTypeDescription
sourceLanguagestringbcp47 id of the source language, such as 'en'
countsobject.<string, number>map from target language to word count

docs autogenerated via jsdoc2md

Community

Contributing

See CONTRIBUTING.md.

License

Apache 2.0. See LICENSE.txt

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Keywords

FAQs

Package last updated on 02 Nov 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc