本站源代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 line
894B

  1. #!/usr/bin/env bash
  2. set -e
  3. #
  4. # This script is used to copy the en-US content to our available locales as a
  5. # fallback to always show all pages when displaying a specific locale that is
  6. # missing some documents to be translated.
  7. #
  8. # Just execute the script without any argument and you will get the missing
  9. # files copied into the content folder. We are calling this script within the CI
  10. # server simply by `make trans-copy`.
  11. #
  12. declare -a LOCALES=(
  13. "fr-fr"
  14. "nl-nl"
  15. "pt-br"
  16. "zh-cn"
  17. "zh-tw"
  18. )
  19. ROOT=$(realpath $(dirname $0)/..)
  20. for SOURCE in $(find ${ROOT}/content -type f -iname *.en-us.md); do
  21. for LOCALE in "${LOCALES[@]}"; do
  22. DEST="${SOURCE%.en-us.md}.${LOCALE}.md"
  23. if [[ ! -f ${DEST} ]]; then
  24. echo "Creating fallback for ${DEST#${ROOT}/content/}"
  25. cp ${SOURCE} ${DEST}
  26. sed -i.bak "s/en\-us/${LOCALE}/g" ${DEST}
  27. rm ${DEST}.bak
  28. fi
  29. done
  30. done
上海开阖软件有限公司 沪ICP备12045867号-1