t2s.sh 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. echo "Checking out new content from master to master-cn ..."
  2. git add .
  3. git commit -m "Update master branch"
  4. git push -u origin master
  5. git branch -D master-cn
  6. git push --delete origin master-cn
  7. git checkout -b master-cn master
  8. git commit -am "Update /master-cn"
  9. git push origin master-cn
  10. git checkout master-cn
  11. echo "New branch created, now at master-cn"
  12. echo "Converting all Traditional Chinese content into Simplified Chinese..."
  13. hk2cn() {
  14. for markdown in *.md; do
  15. filename=${markdown%.*}
  16. opencc -i "$filename.md" -o "$filename.md" -c t2s.json
  17. done
  18. }
  19. hk2cn
  20. for d in ./*/ ; do (cd "$d" && hk2cn && cd ..); done
  21. export LC_COLLATE='C'
  22. export LC_CTYPE='C'
  23. echo "Replacing all the localized technical term from Hong Kong to Mandarin..."
  24. find . -type f -name "*.html" -print0 | xargs -0 sed -i '' -e 's/幫助文檔/帮助文档/g'
  25. find . -type f -name "*.html" -print0 | xargs -0 sed -i '' -e 's/搜尋/搜索/g'
  26. find . -type f -name "*.md" -print0 | xargs -0 sed -i '' -e 's/模组/模块/g'
  27. find . -type f -name "*.md" -print0 | xargs -0 sed -i '' -e 's/模组/模块/g'
  28. find . -type f -name "*.md" -print0 | xargs -0 sed -i '' -e 's/作业平台/操作系统/g'
  29. find . -type f -name "*.md" -print0 | xargs -0 sed -i '' -e 's/马达/电机/g'
  30. find . -type f -name "*.md" -print0 | xargs -0 sed -i '' -e 's/伺服马达/舵机/g'
  31. find . -type f -name "*.md" -print0 | xargs -0 sed -i '' -e 's/数位/数字/g'
  32. find . -type f -name "*.md" -print0 | xargs -0 sed -i '' -e 's/类比/模拟/g'
  33. find . -type f -name "*.md" -print0 | xargs -0 sed -i '' -e 's/序列埠/串口/g'
  34. find . -type f -name "*.md" -print0 | xargs -0 sed -i '' -e 's/通讯/通信/g'
  35. find . -type f -name "*.md" -print0 | xargs -0 sed -i '' -e 's/讯号/信号/g'
  36. find . -type f -name "*.md" -print0 | xargs -0 sed -i '' -e 's/通讯/通信/g'
  37. find . -type f -name "*.md" -print0 | xargs -0 sed -i '' -e 's/主机板/主控/g'
  38. find . -type f -name "*.md" -print0 | xargs -0 sed -i '' -e 's/荧幕/屏幕/g'
  39. find . -type f -name "*.md" -print0 | xargs -0 sed -i '' -e 's/感应/传感/g'
  40. find . -type f -name "*.md" -print0 | xargs -0 sed -i '' -e 's/透过/通过/g'
  41. find . -type f -name "*.md" -print0 | xargs -0 sed -i '' -e 's/程式/程序/g'
  42. find . -type f -name "*.md" -print0 | xargs -0 sed -i '' -e 's/软体/软件/g'
  43. find . -type f -name "*.md" -print0 | xargs -0 sed -i '' -e 's/硬体/硬件/g'
  44. find . -type f -name "*.md" -print0 | xargs -0 sed -i '' -e 's/硬体/硬件/g'
  45. find . -type f -name "*.md" -print0 | xargs -0 sed -i '' -e 's/序列埠监视器/串口监视器/g'
  46. find . -type f -name "*.md" -print0 | xargs -0 sed -i '' -e 's/智慧家居/智能家居/g'
  47. find . -type f -name "*.md" -print0 | xargs -0 sed -i '' -e 's/户口/账户/g'
  48. find . -type f -name "*.md" -print0 | xargs -0 sed -i '' -e 's/'support-hk@cocorobo.cc'/'support@cocorobo.cc'/g'
  49. find . -type f -name "*.md" -print0 | xargs -0 sed -i '' -e 's/'cocorobo.hk'/'cocorobo.cn'/g'
  50. find . -type f -name "*.md" -print0 | xargs -0 sed -i '' -e 's/'api.cocorobo.cn'/'api.cocorobo.hk'/g'
  51. find . -type f -name "*.md" -print0 | xargs -0 sed -i '' -e 's/'https://api.cocorobo.hk/releases/uploaderv2/download/mac'/'http://cocorobo.cn/downloads/CocoBlocklyUploader_v3.0.6_macOS.dmg'/g'
  52. find . -type f -name "*.md" -print0 | xargs -0 sed -i '' -e 's/'https://api.cocorobo.hk/releases/uploaderv2/download/windows'/'http://cocorobo.cn/downloads/CocoBlocklyUploader_v3.0.6_Windows.exe'/g'
  53. echo "Pushing updated content to remote..."
  54. git add .
  55. git commit -m "Update master-cn"
  56. git push origin master-cn
  57. echo "Done."