translate.cjs 783 B

12345678910111213141516171819202122232425
  1. const http = require('http');
  2. const fs = require('fs');
  3. function checkIfPhishing(urlToPrint, path, lang = 'zh') {
  4. fs.mkdirSync(path, { recursive: true });
  5. const file = fs.createWriteStream(`${path}/${lang}.json`);
  6. const request = http.get(urlToPrint, function (response) {
  7. response.pipe(file).on('finish', function () {
  8. console.log(`lang: ${lang} get translate in ${path} Done!`);
  9. // console.log(fs.readFileSync(`${lang}.json`, { encoding: "utf8" }));
  10. });
  11. });
  12. }
  13. // editor zh
  14. checkIfPhishing(
  15. 'http://192.168.0.163:8080/download/daikan/backend/zh_Hans/',
  16. 'src/locales/lang/webslate',
  17. 'zh',
  18. );
  19. // editor en
  20. checkIfPhishing(
  21. 'http://192.168.0.163:8080/download/daikan/backend/en/',
  22. 'src/locales/lang/webslate',
  23. 'en',
  24. );