@eliumhq/elium-i18n
Advanced tools
Comparing version 1.0.5 to 1.0.6
{ | ||
"name": "@eliumhq/elium-i18n", | ||
"version": "1.0.5", | ||
"version": "1.0.6", | ||
"engines": { | ||
@@ -5,0 +5,0 @@ "node": ">=9", |
@@ -1,2 +0,2 @@ | ||
const { exec } = require('child_process') | ||
const { exec } = require('./utils') | ||
@@ -7,3 +7,3 @@ function ensureArray (arr) { | ||
module.exports = (languages, commit = true) => { | ||
module.exports = async (languages, commit = true, source) => { | ||
console.log('Pulling PO files...') | ||
@@ -15,23 +15,29 @@ const langs = languages | ||
: '-a ' | ||
exec(`tx pull ${langs}`, (error, stdout, stderr) => { | ||
if (error) { | ||
console.error(error) | ||
console.warn('Be sure to have the transifex-client : pip install transifex-cli') | ||
process.exit(1) | ||
try { | ||
// We have to force the pull otherwise existing languages are skipped | ||
await exec(`tx pull ${langs} -f`) | ||
// Transifex does not download the translation file for the source language | ||
if (source) { | ||
console.log('Download translations for source language') | ||
await exec(`tx pull -l ${source} -f`) | ||
} | ||
console.log('Translations downloaded.') | ||
} catch (err) { | ||
console.error(err) | ||
console.warn('Be sure to have the transifex-client : pip install transifex-cli') | ||
process.exit(1) | ||
} | ||
console.log('Translations downloaded.') | ||
if (commit) { | ||
console.log('Committing...') | ||
exec('git add translations/*/*.po', () => { | ||
exec(`git commit -m"chore(i18n): Update translations"`, (error, stdout, stderr) => { | ||
if (error) { | ||
console.error(error) | ||
process.exit(1) | ||
} | ||
console.log('Done !') | ||
}) | ||
}) | ||
if (commit) { | ||
console.log('Committing...') | ||
try { | ||
await exec('git add translations/*/*.po') | ||
await exec(`git commit -m"chore(i18n): Update translations"`) | ||
console.log('Done !') | ||
} catch (err) { | ||
console.error(err) | ||
process.exit(1) | ||
} | ||
}) | ||
} | ||
} |
@@ -1,17 +0,16 @@ | ||
const { exec } = require('child_process') | ||
const { exec } = require('./utils') | ||
module.exports = () => { | ||
module.exports = async () => { | ||
console.log('Pushing POT to Transifex...') | ||
exec(`tx push -s`, (error, stdout, stderr) => { | ||
if (error) { | ||
console.warn(` | ||
Be sure you have : | ||
1. pip install transifex-cli | ||
2. ~/.transifexrc | ||
`) | ||
console.error(error) | ||
return | ||
} | ||
try { | ||
await exec(`tx push -s`) | ||
console.log('Template pushed.') | ||
}) | ||
} catch (err) { | ||
console.warn(` | ||
Be sure you have : | ||
1. pip install transifex-cli | ||
2. ~/.transifexrc | ||
`) | ||
console.error(err) | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
56948
16
359
1