This repository has been archived on 2023-06-19. You can view files and clone it, but cannot push or open issues or pull requests.
website/scripts/trans-copy.sh
John Olheiser 34a438c88a
All checks were successful
continuous-integration/drone/push Build is passing
fix: run hugo directly instead of plugin image (#115)
ref: https://github.com/go-gitea/gitea/pull/22206
Co-authored-by: jolheiser <john.olheiser@gmail.com>
Reviewed-on: #115
Reviewed-by: techknowlogick <techknowlogick@gitea.io>
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: John Olheiser <john+gitea@jolheiser.com>
Co-committed-by: John Olheiser <john+gitea@jolheiser.com>
2022-12-22 10:22:57 +08:00

34 lines
775 B
Bash
Executable File

#!/usr/bin/env bash
set -e
#
# This script is used to copy the en-US content to our available locales as a
# fallback to always show all pages when displaying a specific locale that is
# missing some documents to be translated.
#
# Just execute the script without any argument and you will get the missing
# files copied into the content folder. We are calling this script within the CI
# server simply by `make trans-copy`.
#
declare -a LOCALES=(
"ru-ru"
"ja-jp"
"nl-nl"
"pt-br"
"zh-cn"
"zh-tw"
)
ROOT=$(realpath $(dirname $0)/..)
for SOURCE in $(find ${ROOT}/content -type f -iname *.en-us.md); do
for LOCALE in "${LOCALES[@]}"; do
DEST="${SOURCE%.en-us.md}.${LOCALE}.md"
if [[ ! -f ${DEST} ]]; then
cp ${SOURCE} ${DEST}
fi
done
done