Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

repo sync #11653

Merged
merged 6 commits into from
Nov 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions script/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -394,17 +394,17 @@ This is a convenience script for replacing the contents of translated files with

It's intended to be a workaround to temporarily bypass Crowdin parser bugs while we wait for translators to fix them.

Usage: script/reset-translated-file.js <filename>
Usage: script/i18n/reset-translated-file.js <filename>

Examples:

reset a single translated file using a relative path: $ script/reset-translated-file.js translations/es-XL/content/actions/index.md
reset a single translated file using a relative path: $ script/i18n/reset-translated-file.js translations/es-XL/content/actions/index.md

reset a single translated file using a full path: $ script/reset-translated-file.js /Users/z/git/github/docs-internal/translations/es-XL/content/actions/index.md
reset a single translated file using a full path: $ script/i18n/reset-translated-file.js /Users/z/git/github/docs-internal/translations/es-XL/content/actions/index.md

reset all language variants of a single English file (using a relative path): $ script/reset-translated-file.js content/actions/index.md $ script/reset-translated-file.js data/ui.yml
reset all language variants of a single English file (using a relative path): $ script/i18n/reset-translated-file.js content/actions/index.md $ script/i18n/reset-translated-file.js data/ui.yml

reset all language variants of a single English file (using a full path): $ script/reset-translated-file.js /Users/z/git/github/docs-internal/content/desktop/index.md $ script/reset-translated-file.js /Users/z/git/github/docs-internal/data/ui.yml
reset all language variants of a single English file (using a full path): $ script/i18n/reset-translated-file.js /Users/z/git/github/docs-internal/content/desktop/index.md $ script/i18n/reset-translated-file.js /Users/z/git/github/docs-internal/data/ui.yml

---

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ import path from 'path'
import { execSync } from 'child_process'
import { get, set } from 'lodash-es'
import fs from 'fs'
import readFileAsync from '../lib/readfile-async.js'
import fm from '../lib/frontmatter.js'
import readFileAsync from '../../lib/readfile-async.js'
import fm from '../../lib/frontmatter.js'
import matter from 'gray-matter'
import chalk from 'chalk'
import yaml from 'js-yaml'
import ghesReleaseNotesSchema from '../tests/helpers/schemas/ghes-release-notes-schema.js'
import ghesReleaseNotesSchema from '../../tests/helpers/schemas/ghes-release-notes-schema.js'
import revalidator from 'revalidator'
const __dirname = path.dirname(fileURLToPath(import.meta.url))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// [start-readme]
//
// Use this script as part of the Crowdin merge process to output a list of parsing and rendering
// errors in translated files and run script/reset-translated-file.js on them.
// errors in translated files and run script/i18n/reset-translated-file.js on them.
//
// [end-readme]

Expand All @@ -23,15 +23,15 @@ try {
// 2. Check for rendering errors and output to file. Note this one must be run SECOND.
console.log('Checking for rendering errors...')
try {
execSync(`script/test-render-translation.js > ${renderErrorsLog}`)
execSync(`script/i18n/test-render-translation.js > ${renderErrorsLog}`)
} catch (error) {
console.log('There were new rendering errors!')
}

// Reset the broken files.
console.log('Resetting broken files...')
execSync(
`cat ${parsingErrorsLog} ${renderErrorsLog} | egrep "^translations/.*/(.+.md|.+.yml)$" | uniq | xargs -L1 script/reset-translated-file.js --prefer-main`
`cat ${parsingErrorsLog} ${renderErrorsLog} | egrep "^translations/.*/(.+.md|.+.yml)$" | uniq | xargs -L1 script/i18n/reset-translated-file.js --prefer-main`
)

// Print a message with next steps.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
// [start-readme]
//
// Use this script as part of the Crowdin merge process to get the list of known broken
// files and run script/reset-translated-file.js on them.
// files and run script/i18n/reset-translated-file.js on them.
//
// [end-readme]

import dotenv from 'dotenv'
import Github from './helpers/github.js'
import Github from '../helpers/github.js'
import { promisify } from 'util'
import ChildProcess from 'child_process'

Expand Down Expand Up @@ -44,7 +44,7 @@ async function main() {
await Promise.all(
brokenFilesArray.map(async (file) => {
console.log(`resetting ${file}`)
await exec(`script/reset-translated-file.js --prefer-main ${file}`)
await exec(`script/i18n/reset-translated-file.js --prefer-main ${file}`)
})
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
// while we wait for translators to fix them.
//
// Usage:
// script/reset-translated-file.js <filename>
// script/i18n/reset-translated-file.js <filename>
//
// Examples:
//
// $ script/reset-translated-file.js translations/es-XL/content/actions/index.md
// $ script/i18n/reset-translated-file.js translations/es-XL/content/actions/index.md
//
// [end-readme]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@

import { fileURLToPath } from 'url'
import path from 'path'
import renderContent from '../lib/render-content/index.js'
import loadSiteData from '../lib/site-data.js'
import { loadPages } from '../lib/page-data.js'
import languages from '../lib/languages.js'
import renderContent from '../../lib/render-content/index.js'
import loadSiteData from '../../lib/site-data.js'
import { loadPages } from '../../lib/page-data.js'
import languages from '../../lib/languages.js'
import { promisify } from 'util'
import ChildProcess, { execSync } from 'child_process'
import fs from 'fs'
import frontmatter from '../lib/frontmatter.js'
import frontmatter from '../../lib/frontmatter.js'
import chalk from 'chalk'
import { YAMLException } from 'js-yaml'

Expand Down Expand Up @@ -91,7 +91,7 @@ async function loadAndPatchSiteData(filesWithKnownIssues = {}) {

// Reset the file
console.warn(`resetting file "${relPath}" due to loadSiteData error: ${error.toString()}`)
await exec(`script/reset-translated-file.js --prefer-main ${relPath}`)
await exec(`script/i18n/reset-translated-file.js --prefer-main ${relPath}`)

// Try to load the site data again
return loadAndPatchSiteData(filesWithKnownIssues)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
// [end-readme]

import dotenv from 'dotenv'
import Github from './helpers/github.js'
import Github from '../helpers/github.js'
import { execSync } from 'child_process'

dotenv.config()
Expand Down