Client for lokalise.co
npm i lokalise-client --save
or yarn add lokalise-client
const client = new LokaliseClient({
token: '%token%',
langs: ['en', 'ru'],
});
client
.fetchProjects(['%projectId1%', '%projectId2%'])
.then(projects => {
projects.forEach(project => {
project.defaultLanguage = 'en';
});
return projects;
})
.then(projects => {
const project = LokaliseClient.mergeProjects(projects, '%new project id');
project
.save('src/locale/')
.then(languages => {
languages.forEach(language => console.log('Processed: ', language));
})
.catch(language => {
console.log('Save locale failed! ', language)
});
});