Node interface for the Lokalise APIv2.
View the Project on GitHub lokalise/node-lokalise-api
const files = await lokaliseApi.files().list({
project_id: project_id,
page: 3,
limit: 4
});
files.items[0].filename;
Exports project files as a .zip
bundle and makes them available to download (the link is valid for 12 months).
const response = await lokaliseApi.files().download(project_id,
{format: 'json', "original_filenames": true}
);
response.bundle_url;
Background uploading is the only method of importing files since July 2020.
process = await lokaliseApi.files().upload(project_id,
{data: data_base64, filename: 'test1.json', lang_iso: 'en'}
);
process.status; // => 'queued'
Asynchronous upload will return a QueuedProcess
containing process ID, status of the process (queued
, finished
, failed
etc) and some other info. You may periodically check the status of the process by using get()
method:
process = await lokaliseApi.files().upload(project_id,
{data: data_base64, filename: 'test1.json', lang_iso: 'en'}
);
// You'll obtain `process_id` after calling `files.upload()`
process = await lokaliseApi.queuedProcesses().get(process.process_id, { project_id: project_id })
process.status // => 'finished'
Please note that this endpoint does not support “software localization” projects.
const response = await lokaliseApi.files().delete(file_id,
{ project_id: project_id }
);
response.project_id // => "123.abc"
response.file_deleted // => true