ClickHouse/docs/tools/translate/replace-with-translation.sh
Ivan Blinkov 2e1f6bc56d
[experimental] add "es" docs language as machine translated draft (#9787)
* replace exit with assert in test_single_page

* improve save_raw_single_page docs option

* More grammar fixes

* "Built from" link in new tab

* fix mistype

* Example of include in docs

* add anchor to meeting form

* Draft of translation helper

* WIP on translation helper

* Replace some fa docs content with machine translation

* add normalize-en-markdown.sh

* normalize some en markdown

* normalize some en markdown

* admonition support

* normalize

* normalize

* normalize

* support wide tables

* normalize

* normalize

* normalize

* normalize

* normalize

* normalize

* normalize

* normalize

* normalize

* normalize

* normalize

* normalize

* normalize

* lightly edited machine translation of introdpection.md

* lightly edited machhine translation of lazy.md

* WIP on translation utils

* Normalize ru docs

* Normalize other languages

* some fixes

* WIP on normalize/translate tools

* add requirements.txt

* [experimental] add es docs language as machine translated draft

* remove duplicate script

* Back to wider tab-stop (narrow renders not so well)
2020-03-21 07:11:51 +03:00

18 lines
489 B
Bash
Executable File

#!/usr/bin/env bash
# Usage: replace-with-translation.sh <target_language> <path>
set -e
BASE_DIR=$(dirname $(readlink -f $0))
TEMP_FILE=$(mktemp)
trap 'rm -f -- "${TEMP_FILE}"' INT TERM HUP EXIT
TARGET_LANGUAGE="$1"
INPUT="$2"
cat "${INPUT}" > "${TEMP_FILE}"
if [[ ! -z $SLEEP ]]
then
sleep $[ ( $RANDOM % 20 ) + 1 ]s
fi
git rm -f "${INPUT}"
mkdir -p $(dirname "${INPUT}") || true
YANDEX=1 "${BASE_DIR}/translate.sh" "${TARGET_LANGUAGE}" "${TEMP_FILE}" "${INPUT}"
git add "${INPUT}"