Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

reset-known-broken-translation-files.js 1.5 KB

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
  1. #!/usr/bin/env node
  2. require('dotenv').config()
  3. const github = require('./helpers/github')()
  4. const { promisify } = require('util')
  5. const exec = promisify(require('child_process').exec)
  6. // Check for required PAT
  7. if (!process.env.GITHUB_TOKEN) {
  8. console.error('Error! You must have a GITHUB_TOKEN set in an .env file to run this script.')
  9. process.exit(1)
  10. }
  11. // [start-readme]
  12. //
  13. // Use this script as part of the Crowdin merge process to get the list of known broken
  14. // files and run script/reset-translated-file.js on them.
  15. //
  16. // [end-readme]
  17. main()
  18. async function main () {
  19. // Get body text of OP from https://github.com/github/localization-support/issues/489.
  20. const { data: { body } } = await github.issues.get({
  21. owner: 'github',
  22. repo: 'localization-support',
  23. issue_number: '489'
  24. })
  25. // Get the list of broken files from the body text.
  26. const brokenFiles = body
  27. .replace(/^[\s\S]*?## List of Broken Translations/m, '')
  28. .trim()
  29. // Turn it into a simple array of files.
  30. const brokenFilesArray = brokenFiles
  31. .split('\n')
  32. .map(line => line.replace('- [ ] ', '').trim())
  33. // Run the script to revert them.
  34. await Promise.all(brokenFilesArray.map(async (file) => {
  35. console.log(`resetting ${file}`)
  36. await exec(`script/reset-translated-file.js --prefer-main ${file}`)
  37. }))
  38. // Print a message with next steps.
  39. console.log(`
  40. Success!
  41. Verify changes with git status and then run:
  42. git commit --no-verify -m "Reset broken translated files to English"
  43. `)
  44. }
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...