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

trans-copy 815 B

1234567891011121314151617181920212223242526272829303132
  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. "nl-nl"
  14. "pt-br"
  15. "zh-cn"
  16. "zh-tw"
  17. )
  18. ROOT=$(realpath $(dirname $0)/..)
  19. for SOURCE in $(find ${ROOT}/content -type f -iname *.en-us.md); do
  20. for LOCALE in "${LOCALES[@]}"; do
  21. DEST="${SOURCE%.en-us.md}.${LOCALE}.md"
  22. if [[ ! -f ${DEST} ]]; then
  23. echo "Creating fallback for ${DEST#${ROOT}/content/}"
  24. cp ${SOURCE} ${DEST}
  25. fi
  26. done
  27. done