![Create React App Officially Deprecated Amid React 19 Compatibility Issues](https://cdn.sanity.io/images/cgdhsj6q/production/04fa08cf844d798abc0e1a6391c129363cc7e2ab-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Create React App Officially Deprecated Amid React 19 Compatibility Issues
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
g11n-pipeline
Advanced tools
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 Node.js.
For a working Bluemix application sample, see gp-nodejs-sample.
Add g11n-pipeline
to your project, as well as cfenv
.
npm install --save g11n-pipeline cfenv
Load the gaas client object as follows (using cfenv ).
var appEnv = require('cfenv').getAppEnv();
var gpClient = require('g11n-pipeline').getClient({
appEnv: appEnv
});
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!',
…
}
See TESTING.md
APIs take a callback and use this general pattern:
gpClient.function( { /*params*/ } , function callback(err, ...))
err
: if truthy, indicates an error has occured....
: other parameters (optional)These APIs may be promisified easily using a library such as Q
's
nfcall:
return Q.ninvoke(bundle, "delete", {});
return Q.ninvoke(gpClient, "getBundleList", {});
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.
Author: Steven R. Loomis
Client
a Regex for matching the service. Usage: var credentials = require('cfEnv') .getAppEnv().getServiceCreds(gp.serviceRegex);
Kind: static property of g11n-pipeline
Properties
Name |
---|
serviceRegex |
Example credentials
Kind: static property of g11n-pipeline
Properties
Name |
---|
exampleCredentials |
Kind: inner class of g11n-pipeline
Do we have access to the server?
Kind: instance property of Client
Param | Type | Description |
---|---|---|
args | object | (ignored) |
cb | callback |
Get a list of the bundles. Note: This function may be deprecated soon, but won't be removed.
Kind: instance method of Client
Param | Type | Description |
---|---|---|
opts | Object | |
opts.serviceInstance | String | optional service instance |
cb | bundleListCallback | callback: (err, array-of-ids) |
This function returns a map from source language(s) to target language(s).
Kind: instance method of Client
Param | Type | Description |
---|---|---|
args | object | |
cb | supportedTranslationsCallback | (err, map-of-languages) |
Get information about this service
Kind: instance method of Client
Param | Type |
---|---|
args | object |
cb | basicCallback |
Create a user Note: This function may be deprecated soon, but won't be removed.
Kind: instance method of Client
Param | Type | Description |
---|---|---|
args | object | |
args.type | string | User type (ADMINISTRATOR, TRANSLATOR, or READER) |
args.displayName | string | Optional display name for the user. This can be any string. |
args.comment | string | Optional comment |
args.bundles | Array | set of accessible bundle ids or ['*'] to mean “all bundles” |
args.metadata | Object | optional key/value pairs for user metadata |
args.externalId | string | optional external user ID for your application’s use |
cb | basicCallback |
Delete a user. Note: This function may be deprecated soon, but won't be removed.
Kind: instance method of Client
Param | Type | Description |
---|---|---|
args | object | TBD |
args.userId | string | user ID to be deleted. |
cb | basicCallback |
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
Param | Type | Description |
---|---|---|
opts | Object | String (id) or map {id: bundleId, serviceInstance: serviceInstanceId} |
Kind: inner class of g11n-pipeline
Param | Type | Description |
---|---|---|
gp | Client | parent g11n-pipeline client object |
props | Object | properties to inherit |
List of fields usable with Bundle.getInfo()
Kind: instance property of Bundle
Delete this bundle.
Kind: instance method of Bundle
Param | Type |
---|---|
opts | Object |
cb | basicCallback |
Create this bundle.
Kind: instance method of Bundle
Param | Type | Description |
---|---|---|
body | Object | - |
body.sourceLanguage | string | bcp47 id of source language such as 'en' |
body.targetLanguages | Array | optional array of target languages |
body.metadata | Object | optional metadata for the bundle |
body.partner | string | optional ID of partner assigned to translate this bundle |
cb | basicCallback |
Get bundle info
Kind: instance method of Bundle
Param | Type | Description |
---|---|---|
opts | Object | Options object |
opts.fields | String | Comma separated list of fields |
opts.translationStatusMetricsByLanguage | Boolean | Optional field (false by default) |
opts.reviewStatusMetricsByLanguage | Boolean | Optional field (false by default) |
opts.partnerStatusMetricsByLanguage | Boolean | Optional field (false by default) |
cb | basicCallback | callback (err, { updatedBy, updatedAt, sourceLanguage, targetLanguages, readOnly, metadata, partner} ) |
Fetch one entry's strings
Kind: instance method of Bundle
Param | Type | Description |
---|---|---|
opts | Object | options |
opts.languageId | String | language to fetch |
opts.resourceKey | String | resource to fetch |
cb | basicCallback | callback (err, { resourceStrings: { strings … } }) |
Fetch one entry's info Note: This function may be deprecated soon, but won't be removed.
Kind: instance method of Bundle
Param | Type | Description |
---|---|---|
opts | Object | options |
opts.languageId | String | language to fetch |
opts.resourceKey | String | resource to fetch |
cb | basicCallback | callback (err, { resourceEntry: { updatedBy, updatedAt, value, sourceValue, reviewed, translationStatus, metadata, partnerStatus } } ) |
Upload resource strings, replacing all current contents for the language
Kind: instance method of Bundle
Param | Type | Description |
---|---|---|
opts | Object | options |
opts.languageId | String | language to update |
opts.strings | Object.<string, string> | strings to update |
cb | basicCallback |
Kind: instance method of Bundle
Param | Type | Description |
---|---|---|
opts | Object | options |
opts.targetLanguages | array | optional: list of target languages to update |
opts.readOnly | boolean | optional: set this bundle to be readonly or not |
opts.metadata | object | optional: metadata to update |
opts.partner | string | optional: partner id to update |
cb | basicCallback | callback |
Update some strings in a language.
Kind: instance method of Bundle
Param | Type | Description |
---|---|---|
opts | Object | options |
opts.strings | Object.<string, string> | strings to update. |
opts.resync | Boolean | optional: If true, resynchronize strings in the target language and resubmit previously-failing translation operations |
cb | basicCallback |
Note: This function may be deprecated soon, but won't be removed.
Kind: instance method of Bundle
Param | Type | Description |
---|---|---|
opts | Object | options |
opts.value | string | string value to update |
opts.reviewed | boolean | optional boolean indicating if value was reviewed |
opts.metadata | object | optional metadata to update |
opts.partnerStatus | string | translation status maintained by partner |
cb | basicCallback |
Client
Construct a g11n-pipeline client. params.credentials is required unless params.appEnv is supplied.
Kind: inner method of g11n-pipeline
Param | Type | Description |
---|---|---|
params | Object | configuration params |
params.appEnv | Object | pass the result of cfEnv.getAppEnv(). Ignored if params.credentials is supplied. |
params.credentials | Object.<string, string> | Bound credentials as from the CF service broker (overrides appEnv) |
params.credentials.url | string | service URL. (should end in '/translate') |
params.credentials.userId | string | service API key. |
params.credentials.password | string | service API key. |
params.credentials.instanceId | string | instance ID |
docs autogenerated via jsdoc2md
You can post questions about using this service in the developerWorks Answers site using the tag "[globalization-pipeline](https://developer.ibm.com/answers/topics/globalization-pipeline /)".
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.
FAQs
JavaScript client for IBM Globalization Pipeline
The npm package g11n-pipeline receives a total of 0 weekly downloads. As such, g11n-pipeline popularity was classified as not popular.
We found that g11n-pipeline demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.