translate.js 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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
  8. .on('finish', function () {
  9. console.log('done');
  10. // console.log(fs.readFileSync(`${lang}.json`, { encoding: "utf8" }));
  11. })
  12. .pipe(file);
  13. });
  14. }
  15. // zh
  16. checkIfPhishing(
  17. 'http://192.168.0.163:8080/download/4kankan/eletron_laster_local/zh_Hans/',
  18. 'src/locales/lang/weblate',
  19. 'zh',
  20. );
  21. // en
  22. checkIfPhishing(
  23. 'http://192.168.0.163:8080/download/4kankan/eletron_laster_local/en/',
  24. 'src/locales/lang/weblate',
  25. 'en',
  26. );
  27. // // ja
  28. // checkIfPhishing(
  29. // 'http://192.168.0.163:8080/download/4kankan/eletron_laster_local/ja/',
  30. // 'src/i18n/weblate',
  31. // 'ja'
  32. // )
  33. // // ja
  34. // checkIfPhishing(
  35. // 'http://192.168.0.163:8080/download/4kankan/eletron_laster_local/ko/',
  36. // 'src/i18n/weblate',
  37. // 'kr'
  38. // )