IBM-Cloud / gp-cordova-plugin

Cordova plugin for Globalization Pipeline
https://developer.ibm.com/open/ibm-bluemix-globalization-pipeline/cordova-sdk/
Other
0 stars 4 forks source link

Cordova plugin for IBM Globalization Pipeline

What is this?

This is a Cordova plugin and sample code for the Globalization Pipeline Bluemix service. The IBM Globalization Pipeline makes it easy for you to provide your global customers with Bluemix applications translated into the languages in which they work.

Adding this plugin into your cordova-based project, your application can dynamically request translations of your application content from the IBM Globalization Pipeline.

Getting started

To get started, 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.

Installation

API convention

APIs which take two callbacks use this pattern:

obj.function( { /*params*/ } , function successCallBack(err), function failureCallBack(result))

All language identifiers are IETF BCP47 codes.

API reference

igp

Author: Jian Jun Wang
Reviewer: Steven Atkin, Terry Tong

class:igp~Client

client.supportedTranslationLangs(args, successCB, failureCB)

Description: This function returns an array containing all target language(s).

Params

client.ping(successCB, failureCB)

Description: Do we have access to the server?

Params

client.getTranslation(args, successCB, failureCB) - High level API

Description

Params

client.download(args, successCB, failureCB) - low level API

Description: Plug-in checks if the resource data in plugin database expires. (The expiration duration is configured by the developer.). If cache expires, Plug-in will access the IBM Globalization Pipeline on bluemix to synchronize the resource data in the local storage with the server.

Params

client.loadTranslationInCache(args, successCB, failureCB) - low level API

Description: Plug-in loads resource data from its local storage directly.

Params

class:igp~ResourceData

Description: This class contains the resource data from IBM Globalization Pipeline.

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.