-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtrigger_weblate.sh
70 lines (54 loc) · 1.43 KB
/
trigger_weblate.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/bin/bash
api_token=$3
language=$2
url=$1
act=$4
if [[ $api_token = "" || $language = "" || $url = "" || $act = "" ]]; then
echo "failed weblate api call, wrong args provided"
exit 1
fi
if [[ $act = "pull" ]]; then
curl -sS \
--data-binary '{
"operation":"pull"
}' \
-H "Content-Type: application/json" \
-H "Authorization: Token $api_token" \
"$url/components/nitrokey-documentation/root/repository/"
fi
#curl \
# --data-binary '{
# "operation":"reset"
# }' \
# -H "Content-Type: application/json" \
# -H "Authorization: Token $api_token" \
# "$url/projects/nitrokey-documentation/repository/"
if [[ $act = "translate" ]]; then
curl -sS \
--data-binary '{
"mode":"translate",
"auto_source":"mt",
"engines":["deepl"],
"filter_type":"nottranslated",
"threshold":"80"
}' \
-H "Content-Type: application/json" \
-H "Authorization: Token $api_token" \
"$url/translations/nitrokey-documentation/root/$language/autotranslate/"
curl -sS \
--data-binary '{
"operation":"commit"
}' \
-H "Content-Type: application/json" \
-H "Authorization: Token $api_token" \
"$url/components/nitrokey-documentation/root/repository/"
fi
if [[ $act = "push" ]]; then
curl \
--data-binary '{
"operation":"push"
}' \
-H "Content-Type: application/json" \
-H "Authorization: Token $api_token" \
"$url/components/nitrokey-documentation/root/repository/"
fi