@w3cub/locize-actions
v5.1.3
Published
Using API actions from cientside
Downloads
24
Readme
This is an standalone scriot to be used for locize api service.
Getting started
Source can be loaded via npm.
# npm package
$ npm install @w3cub/locize-actionsOptions
IMPORTANT make sure you do not add your apiKey in the production build to avoid misuse by strangers
{
// the id of your locize project
projectId: '[PROJECTID]',
// add an api key if you want to send missing keys
apiKey: '[APIKEY]',
// the reference language of your project
referenceLng: '[LNG]',
// version - defaults to latest
version: '[VERSION]',
// debounce interval to send data in milliseconds
debounceSubmit: 90000,
// action path formatter
actionPath: 'https://api.locize.app/{{action}}/{{projectId}}/{{version}}/{{lng}}/{{ns}}',
// hostnames that are allowed to send last used data
// please keep those to your local system, staging, test servers (not production)
allowedHosts: ['localhost']
}Directly call locizeActions.init:
import locizeActions from "locize-actions";
locizeActions.init(options);then call used function with namespace and key:
import locizeActions from "locize-actions";
locizeActions.actions('action', "myNamespace", "myKey.as.in.locize", "myKey.as.the.value", (obj)=> {
// parse function
// for missing action
return Object.keys(obj)
//
});