-
Notifications
You must be signed in to change notification settings - Fork 41
/
trigger_deepl.sh
39 lines (31 loc) · 950 Bytes
/
trigger_deepl.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/bash
# Load Variables
source config.sh
# provide access token from https://translate.nitrokey.com/accounts/profile/#api
token=$1
if [ $# -eq 0 ]
then
echo "Please provide your Weblate Access Token as first Parameter. Get it from https://translate.nitrokey.com/accounts/profile/#api"
exit
fi
for lang in "${languages[@]}"
do
echo -e "\n $(date) Starting deepl Translation for language $lang..."
for component in "${components[@]}"
do
echo -e "$(date) Starting to translate $lang for component $component"
curl \
--data-binary '{
"mode":"translate",
"auto_source":"mt",
"engines":["deepl"],
"filter_type":"nottranslated",
"threshold":"80"
}' \
-H "Content-Type: application/json" \
-H "Authorization: Token $token" \
https://translate.nitrokey.com/api/translations/nitrokey-documentation/$component/$lang/autotranslate/
echo -e "\n$(date) done"
done
echo -e "\n$(date) Language $lang passed"
done