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