1
0
mirror of synced 2026-01-08 12:01:53 -05:00

Merge pull request #12485 from github/repo-sync

repo sync
This commit is contained in:
Octomerger Bot
2021-11-30 08:27:28 -05:00
committed by GitHub
2 changed files with 12 additions and 9 deletions

View File

@@ -1,9 +1,9 @@
#!/usr/bin/env node
import program from 'commander'
import { execSync } from 'child_process'
import { languageFiles, compareLiquidTags } from '../../lib/liquid-tags/tokens.js'
import languages from '../../lib/languages.js'
import fs from 'fs'
program
.description('show-liquid-tags-diff')
@@ -12,15 +12,15 @@ program
.parse(process.argv)
function resetFiles(files) {
console.log(`Files to be reset (${files.length}): \n${files.join('\n')}`)
console.log(`Reseting ${files.length} files:`)
const dryRun = program.opts().dryRun ? '--dry-run' : ''
files.forEach((file) => {
// remove file so it falls back to English
console.log(`removing ${file}`)
if (!program.opts().dryRun) {
fs.unlinkSync(file)
}
execSync(
`script/i18n/reset-translated-file.js ${file} --reason="broken liquid tags" ${dryRun}`,
{ stdio: 'inherit' }
)
})
}

View File

@@ -57,10 +57,13 @@ const resetToEnglishSource = (translationFilePath) => {
}
if (!dryRun) {
// replace file with English source
// it is important to replace the file with English source instead of
// removing it, and relying on the fallback, because redired_from frontmatter
// won't work in fallbacks
const englishContent = fs.readFileSync(englishFile, 'utf8')
fs.writeFileSync(translationFilePath, englishContent)
}
console.log(
'-> reverted to English: %s %s',
path.relative(process.cwd(), translationFilePath),