Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@lokalise/node-api

Package Overview
Dependencies
Maintainers
2
Versions
83
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lokalise/node-api - npm Package Compare versions

Comparing version 5.2.0 to 5.2.1

test/cassettes/Keys create per-platform.cassette

4

docs/additional_info/changelog.md
# Changelog
## 5.2.1 (03-Nov-20)
* Update dependencies
## 5.2.0 (02-Oct-20)

@@ -4,0 +8,0 @@

@@ -31,2 +31,5 @@ # Translation keys

"platforms": ["web"],
"filenames": {
"web": "my_filename.json"
},
"translations": [

@@ -57,2 +60,28 @@ {

Creating a key with per-platform names:
```js
lokaliseApi.keys.create(
[{
key_name: {
ios: "name_for_ios",
web: "name_for_web",
android: "android_name",
other: "other_name"
},
platforms: ["web", "ios"],
translations: [{
language_iso: "en",
translation: "Per-platform key names"
}],
}],
{ project_id: project_id }
);
```
Things to note:
* "Per-platform key names" option must be enabled in the project settings
* You have to provide key names for all four platform (`ios`, `web`, `android`, `other`) even if the key does not belong to all of them
## Update project key

@@ -59,0 +88,0 @@

@@ -10,5 +10,11 @@ # Translations

```js
lokaliseApi.translations.list({project_id: project_id});
lokaliseApi.translations.list({
project_id: project_id,
filter_is_reviewed: 0,
filter_lang_id: 803
});
```
Please note that if you would like to filter translations by their language, you have to provide *language ID*, not language ISO code, as it is shown in the example above!
## Fetch a single translation

@@ -15,0 +21,0 @@

2

docs/index.md

@@ -10,3 +10,3 @@ ---

Install the library:
Install the library using [NPM](https://npmjs.com/):

@@ -13,0 +13,0 @@ npm install @lokalise/node-api

{
"name": "@lokalise/node-api",
"version": "5.2.0",
"version": "5.2.1",
"description": "Official Lokalise API 2.0 Node.js client",

@@ -24,17 +24,17 @@ "license": "BSD-3-Clause",

"@istanbuljs/nyc-config-typescript": "^1.0.1",
"@types/chai": "^4.2.12",
"@types/chai": "^4.2.14",
"@types/mocha": "^8.0.3",
"@types/node": "^14.11.2",
"@typescript-eslint/eslint-plugin": "^4.3.0",
"@typescript-eslint/parser": "^4.3.0",
"acorn": "^8.0.3",
"@types/node": "^14.14.6",
"@typescript-eslint/eslint-plugin": "^4.6.1",
"@typescript-eslint/parser": "^4.6.1",
"acorn": "^8.0.4",
"chai": "^4.2.0",
"codecov": "^3.7.2",
"codecov": "^3.8.1",
"dotenv": "^8.2.0",
"eslint": "^7.10.0",
"eslint-config-prettier": "^6.12.0",
"eslint": "^7.12.1",
"eslint-config-prettier": "^6.15.0",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^3.1.4",
"mocha": "^8.1.3",
"mocha-cassettes": "1.2.0",
"mocha": "^8.2.1",
"mocha-cassettes": "1.2.1",
"nyc": "^15.1",

@@ -46,4 +46,4 @@ "prettier": "2.1.2",

"dependencies": {
"got": "^11.7.0",
"typescript": "^4.0.3"
"got": "^11.8.0",
"typescript": "^4.0.5"
},

@@ -50,0 +50,0 @@ "bugs": {

@@ -6,2 +6,3 @@ # Lokalise API v2 official Node.js client

[![Test Coverage](https://codecov.io/gh/lokalise/node-lokalise-api/graph/badge.svg)](https://codecov.io/gh/lokalise/node-lokalise-api)
![Downloads total](https://img.shields.io/npm/dt/@lokalise/node-api)

@@ -8,0 +9,0 @@ Official Node interface for the [Lokalise API](https://app.lokalise.com/api2docs/curl/#resource-getting-started).

@@ -73,2 +73,5 @@ require("../setup");

platforms: ["web"],
filenames: {
web: "my_filename.json"
},
translations: [

@@ -102,7 +105,8 @@ {

expect(keys[0].platforms).to.include("web");
expect(keys[0].translations[2].translation).to.eq("Welcome");
expect(keys[0].filenames['web']).to.eq("my_filename.json");
expect(keys[0].translations[1].translation).to.eq("Welcome");
expect(keys[1].key_name["ios"]).to.eq("welcome_ios");
expect(keys[1].platforms).to.include("ios");
expect(keys[1].translations[2].language_iso).to.eq("en");
expect(keys[1].translations[1].language_iso).to.eq("en");
})

@@ -112,2 +116,29 @@ .register(this);

cassette
.createTest("create per-platform", async () => {
const keys = await lokaliseApi.keys.create(
[{
key_name: {
ios: "name_for_ios",
web: "name_for_web",
android: "android_name",
other: "other_name"
},
platforms: ["web", "ios"],
translations: [{
language_iso: "en",
translation: "Per-platform key names"
}],
}],
{ project_id: project_id }
);
const key = keys[0]
expect(key.key_name["web"]).to.eq("name_for_web");
expect(key.key_name["ios"]).to.eq("name_for_ios");
expect(key.platforms).to.include("web", "ios");
expect(key.platforms).not.to.include("android", "other");
})
.register(this);
cassette
.createTest("update", async () => {

@@ -114,0 +145,0 @@ const key = await lokaliseApi.keys.update(

@@ -34,2 +34,15 @@ require("../setup");

cassette
.createTest("list with opts", async () => {
const translations = await lokaliseApi.translations.list({
project_id: project_id,
filter_is_reviewed: 0,
filter_lang_id: 803
});
expect(translations[0].translation_id).to.eq(304581213);
expect(translations[0].language_iso).to.eq("sq");
})
.register(this);
cassette

@@ -36,0 +49,0 @@ .createTest("get", async () => {

Sorry, the diff of this file is not supported yet

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