Skip to content

Commit

Permalink
Trigger error when Translation.io is configured with a format differe…
Browse files Browse the repository at this point in the history
…nt than PO
  • Loading branch information
MichaelHoste committed Sep 7, 2021
1 parent 7741630 commit 1ae6d17
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/cli/src/services/translationIO.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ const getCreateHeaders = (language) => ({

// Main sync method, call "Init" or "Sync" depending on the project context
export default function syncProcess(config, options) {
if (config.format != 'po') {
console.error(`\n----------\nTranslation.io service is only compatible with the "po" format. Please update your Lingui configuration accordingly.\n----------`)
process.exit(1)
}

const successCallback = (project) => {
console.log(`\n----------\nProject successfully synchronized. Please use this URL to translate: ${project.url}\n----------`)
}
Expand Down Expand Up @@ -219,8 +224,9 @@ function saveSegmentsToTargetPos(config, paths, segmentsPerLocale) {
fs.promises.mkdir(dirname(localePath), {recursive: true}).then(() => {
po.save(localePath, (err) => {
if (err) {
console.error('Error while saving target PO files')
console.error('Error while saving target PO files:')
console.error(err)
process.exit(1)
}
})
})
Expand Down

0 comments on commit 1ae6d17

Please sign in to comment.