Skip to content

derpierre65/crowdin-updater

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Crowdin Updater

Npm Version Downloads Issues Node Version

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);
	});

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published