@derpierre65/crowdin-updater
v1.2.1
Published
[![Npm Version](https://img.shields.io/npm/v/@derpierre65/crowdin-updater.svg?style=flat)](https://www.npmjs.org/package/@derpierre65/crowdin-updater) [![Downloads](https://img.shields.io/npm/dm/@derpierre65/crowdin-updater.svg?style=flat)](https://www.np
Downloads
1
Readme
Crowdin Updater
Install
Node
$ npm i @derpierre65/crowdin-updater
Example
Updating single files
const CrowdinUpdater = require('@derpierre65/crowdin-updater');
const updater = new CrowdinUpdater({
projectId: 12345,
crowdinMainFile: 'my-default.json',
tempDirectory: path.resolve('./temp-translation.zip'),
localeDirectory: path.resolve('./static/assets/locales/'),
logPath: path.resolve('./crowdin.log'),
authorizationKey: 'Bearer API-TOKEN',
jsonIndent: '\t',
referenceLocale: 'en',
locales: [
{ iso: 'de', file: 'de.json' },
{ iso: 'en', file: 'en.json' },
],
});
updater.update().catch(console.error);
Updating multiple files
const CrowdinUpdater = require('@derpierre65/crowdin-updater');
const updater = new CrowdinUpdater({
projectId: 12345,
crowdinMainFile: 'my-directory/',
// for all crowdin files:
// crowdinMainFile: '',
tempDirectory: path.resolve('./temp-translation.zip'),
localeDirectory: path.resolve('./static/assets/locales/'),
logPath: path.resolve('./crowdin.log'),
authorizationKey: 'Bearer API-TOKEN',
jsonIndent: '\t',
referenceLocale: 'en',
locales: [
'de',
'en',
],
});
updater.update().catch(console.error);
Create a build before update
const updater = new CrowdinUpdater({
projectId: 12345,
crowdinMainFile: 'my-default.json',
tempDirectory: path.resolve('./temp-translation.zip'),
localeDirectory: path.resolve('./static/assets/locales/'),
logPath: path.resolve('./crowdin.log'),
authorizationKey: 'Bearer API-TOKEN',
jsonIndent: '\t',
referenceLocale: 'en',
locales: [
{ iso: 'de', file: 'de.json' },
{ iso: 'en', file: 'en.json' },
],
});
updater
.createBuild()
.then(() => updater.update())
.catch((error) => {
console.error(error);
});