зеркало из https://github.com/go-gitea/website.git
Automatically copy missing translations (#25)
* Automatically copy missing translations * Added all translations to config.yaml
This commit is contained in:
Родитель
7b21083339
Коммит
5276c10a23
|
@ -6,6 +6,8 @@ pipeline:
|
|||
image: webhippie/hugo:latest
|
||||
pull: true
|
||||
commands:
|
||||
- make trans-copy
|
||||
|
||||
- make clean
|
||||
- make build
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
eyJhbGciOiJIUzI1NiJ9.d29ya3NwYWNlOgogIHBhdGg6IHNyYwoKcGlwZWxpbmU6CiAgYnVpbGQ6CiAgICBpbWFnZTogd2ViaGlwcGllL2h1Z286bGF0ZXN0CiAgICBwdWxsOiB0cnVlCiAgICBjb21tYW5kczoKICAgICAgLSBtYWtlIGNsZWFuCiAgICAgIC0gbWFrZSBidWlsZAoKICBjaGVja3M6CiAgICBpbWFnZTogd2ViaGlwcGllL2xpbmtjaGVja2VyOmxhdGVzdAogICAgY29tbWFuZHM6CiAgICAgIC0gbGlua2NoZWNrZXIgLXYgaHR0cDovL2xvY2FsaG9zdDo4MDgwCgogIGRvY2tlcjoKICAgIGltYWdlOiBwbHVnaW5zL2RvY2tlcgogICAgcmVwbzogZ2l0ZWEvd2Vic2l0ZQogICAgdGFnczogWyAnJHtUQUd9JyBdCiAgICB3aGVuOgogICAgICBldmVudDogdGFnCiAgICAgIGJyYW5jaDogcmVmcy90YWdzLyoKCiAgZG9ja2VyOgogICAgaW1hZ2U6IHBsdWdpbnMvZG9ja2VyCiAgICByZXBvOiBnaXRlYS93ZWJzaXRlCiAgICB0YWdzOiBbICdsYXRlc3QnIF0KICAgIHdoZW46CiAgICAgIGV2ZW50OiBwdXNoCiAgICAgIGJyYW5jaDogbWFzdGVyCgogIGdpdHRlcjoKICAgIGltYWdlOiBwbHVnaW5zL2dpdHRlcgoKc2VydmljZXM6CiAgc2VydmVyOgogICAgaW1hZ2U6IHdlYmhpcHBpZS9jYWRkeTpsYXRlc3QKICAgIGNvbW1hbmQ6IFs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VibGljXQo.eKjEQBGny_D4xtkO3Dp7bU2XH4bD3VbIvghls3P29bM
|
4
Makefile
4
Makefile
|
@ -9,6 +9,10 @@ all: build
|
|||
clean:
|
||||
rm -rf $(PUBLIC) $(THEME)
|
||||
|
||||
.PHONY: trans-copy
|
||||
trans-copy:
|
||||
@bash scripts/trans-copy
|
||||
|
||||
.PHONY: server
|
||||
server: $(THEME)
|
||||
hugo server
|
||||
|
|
32
config.yaml
32
config.yaml
|
@ -51,6 +51,7 @@ languages:
|
|||
en-us:
|
||||
weight: 0
|
||||
languageName: English
|
||||
|
||||
zh-cn:
|
||||
weight: 1
|
||||
languageName: 中文(简体)
|
||||
|
@ -143,3 +144,34 @@ languages:
|
|||
url: https://github.com/go-gitea/
|
||||
weight: 60
|
||||
pre: github
|
||||
|
||||
nl-nl:
|
||||
weight: 4
|
||||
languageName: Nederlands
|
||||
menu:
|
||||
page:
|
||||
- name: Website
|
||||
url: /nl-nl/
|
||||
weight: 10
|
||||
pre: home
|
||||
post: active
|
||||
- name: Docs
|
||||
url: https://docs.gitea.io/nl-nl/
|
||||
weight: 20
|
||||
pre: question
|
||||
- name: Blog
|
||||
url: https://blog.gitea.io/
|
||||
weight: 30
|
||||
pre: rss
|
||||
- name: Code
|
||||
url: https://code.gitea.io/
|
||||
weight: 40
|
||||
pre: code
|
||||
- name: Downloads
|
||||
url: https://dl.gitea.io/
|
||||
weight: 50
|
||||
pre: download
|
||||
- name: GitHub
|
||||
url: https://github.com/go-gitea/
|
||||
weight: 60
|
||||
pre: github
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
#!/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=(
|
||||
"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
|
||||
echo "Creating fallback for ${DEST#${ROOT}/content/}"
|
||||
cp ${SOURCE} ${DEST}
|
||||
fi
|
||||
done
|
||||
done
|
Загрузка…
Ссылка в новой задаче