@lokalise/node-api
TypeScript icon, indicating that this package has built-in type declarations

14.7.0 • Public • Published

Lokalise API v2 official Node.js client

npm CI Coverage Status NPM Downloads

Official Node interface for the Lokalise API.

Looking for a simple solution to perform translation uploading/downloading? Try the new lokalise-file-exchange package.

Quickstart

Please note that starting from version 9 this SDK is a pure ESM module. It does not provide a CommonJS export (require) anymore. Therefore you should either convert your project to ESM, use dynamic import (please find an example below), or stay on version 8.

Install the library:

npm install @lokalise/node-api

Obtain Lokalise API token in your personal profile, initialize and use the client:

import { LokaliseApi } from "@lokalise/node-api";

const lokaliseApi = new LokaliseApi({ apiKey: '<apiKey>'});
const projects = await lokaliseApi.projects().list();
projects.items[0].name;

process = await lokaliseApi.files().upload(project_id,
  {data: data_base64, filename: 'test1.json', lang_iso: 'en'})
process.status // => 'queued'

Alternatively, you can use tokens obtained via OAuth2 (don't forget that these tokens have expiration dates):

import { LokaliseApiOAuth } from "@lokalise/node-api";

const lokaliseApi = new LokaliseApiOAuth({ apiKey: '<apiKeyObtainedViaOauth2>' });

const projects = lokaliseApi.projects().list();

Here's an example using dynamic import:

(async function () {
  const LokaliseApi = await (import('@lokalise/node-api').then(m => m.LokaliseApi));
  const lokaliseApi = new LokaliseApi({ apiKey: LOKALISE_API_TOKEN});

  // use lokaliseApi here as usual...
})();

Usage

Detailed documentation can be found at lokalise.github.io/node-lokalise-api.

You can also check this repo containing some usage examples and this blog post with explanations. Finally, you might be interested in our free course "Lokalise for developers" that showcases Node SDK usage.

License

This library is licensed under the BSD 3 Clause. Prior to version 5.1.0 the license was MIT.

Copyright (c) Lokalise group and Ilya Krukowski

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
14.7.0944latest
14.3.0-rc.13rc

Version History

VersionDownloads (Last 7 Days)Published
14.7.0944
14.6.0450
14.5.23,105
14.5.1250
14.5.0306
14.4.03,544
14.3.08,921
14.3.0-rc.13
14.2.12,483
14.2.0719
14.1.01,075
14.0.02,493
13.2.18,793
13.2.0101
13.1.0466
13.0.05,267
12.8.028,820
12.7.03,150
12.6.02,120
12.5.01,084
12.4.11,923
12.4.01,005
12.3.01
12.2.13
12.2.01
12.1.017,633
12.0.0350
11.1.01,363
11.0.1184
11.0.01
10.0.0782
9.8.12,794
8.5.115,994
9.8.02,440
8.5.0118
8.4.013
9.7.06
9.6.1413
8.3.02,177
9.6.01
9.5.034
9.4.014
9.3.022
9.2.02
8.2.0698
8.1.01
9.1.01
9.0.01
9.0.0-beta.21
9.0.0-beta.11
8.0.26,607
8.0.1191
8.0.01,537
7.3.18,255
7.3.01
7.3.0-beta1
7.2.04,401
7.1.1327
7.1.0189
7.0.139
7.0.0277
6.3.01,883
6.2.21
6.2.1551
6.2.049
6.1.096
6.0.03
5.3.03,924
5.2.22
5.2.127
5.2.01
5.1.02
5.0.0169
4.0.158
4.0.0168
3.0.363
3.0.0104
2.1.0115
2.0.21
2.0.13
2.0.02
1.5.0-rc11
1.4.013
1.3.021
1.2.031
1.1.01
1.0.11
1.0.01
0.0.91
0.0.89
0.0.71
0.0.61
0.0.51
0.0.41
0.0.31
0.0.21
0.0.11

Package Sidebar

Install

npm i @lokalise/node-api

Weekly Downloads

151,206

Version

14.7.0

License

BSD-3-Clause

Unpacked Size

920 kB

Total Files

489

Last publish

Collaborators

  • bodrovis
  • marcocardosolok
  • laurislokalise
  • botlokalise
  • kibertoad
  • carlos_gamero
  • aplokalise
  • filippos.mikropoulos
  • arthuracs
  • andrew_lokalise
  • dariacm
  • forter_lokalise
  • mattfinucane
  • bezlydmitry
  • frei_ondrej_lokalise