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

Official Lokalise API 2.0 Node.js client

  • 4.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
134K
increased by15.9%
Maintainers
2
Weekly downloads
 
Created

What is @lokalise/node-api?

@lokalise/node-api is an official Node.js client for the Lokalise API, which allows developers to interact with the Lokalise platform programmatically. Lokalise is a translation management system that helps teams manage localization projects. This package provides a way to automate tasks such as managing projects, uploading and downloading files, and handling translations.

What are @lokalise/node-api's main functionalities?

Managing Projects

This feature allows you to create and manage projects on Lokalise. The code sample demonstrates how to create a new project with a specified name, description, and languages.

const LokaliseApi = require('@lokalise/node-api');
const lokaliseApi = new LokaliseApi({ apiKey: 'your_api_key' });

async function createProject() {
  const project = await lokaliseApi.projects.create({
    name: 'New Project',
    description: 'A new project description',
    languages: [{ lang_iso: 'en' }]
  });
  console.log(project);
}

createProject();

Uploading Files

This feature allows you to upload translation files to a specific project. The code sample demonstrates how to upload a file by providing the project ID, base64 encoded file content, filename, and language ISO code.

const LokaliseApi = require('@lokalise/node-api');
const lokaliseApi = new LokaliseApi({ apiKey: 'your_api_key' });

async function uploadFile() {
  const upload = await lokaliseApi.files.upload('project_id', {
    data: 'base64_encoded_file_content',
    filename: 'translations.json',
    lang_iso: 'en'
  });
  console.log(upload);
}

uploadFile();

Downloading Files

This feature allows you to download translation files from a specific project. The code sample demonstrates how to download files by providing the project ID and specifying the format and whether to use original filenames.

const LokaliseApi = require('@lokalise/node-api');
const lokaliseApi = new LokaliseApi({ apiKey: 'your_api_key' });

async function downloadFile() {
  const download = await lokaliseApi.files.download('project_id', {
    format: 'json',
    original_filenames: true
  });
  console.log(download);
}

downloadFile();

Handling Translations

This feature allows you to handle translations within a project. The code sample demonstrates how to add a new translation key with its corresponding translations by providing the project ID, key name, and translations.

const LokaliseApi = require('@lokalise/node-api');
const lokaliseApi = new LokaliseApi({ apiKey: 'your_api_key' });

async function addTranslation() {
  const translation = await lokaliseApi.keys.create('project_id', {
    keys: [{
      key_name: 'welcome_message',
      translations: [{
        language_iso: 'en',
        translation: 'Welcome!'
      }]
    }]
  });
  console.log(translation);
}

addTranslation();

Other packages similar to @lokalise/node-api

Keywords

FAQs

Package last updated on 18 May 2020

Did you know?

Socket

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.

Install

Related posts

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