forked from ooni/translations
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupdate-run-source.sh
executable file
·40 lines (27 loc) · 956 Bytes
/
update-run-source.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
#!/usr/bin/env bash
RUN_STRINGS_SHEET='https://docs.google.com/spreadsheets/d/e/2PACX-1vTbPW12s3uzs-HZOWJGCIdKpuhsMZZCSy33Iv179yyWqf2ipEVDODuLzZQCz4q0aOnr-buc0BjvEoGz/pub?gid=0&single=true&output=csv'
CSV_FILE_PATH=run/en/strings.csv
JSON_FILE_PATH=run/en/strings.json
echo -n "Fetching latest source strings from spreadsheet..."
curl -sL $RUN_STRINGS_SHEET -o $CSV_FILE_PATH
ret=$?
if [ $ret -ne 0 ]; then
echo "Failed to download CSV file. Curl failed with error code: $ret"
exit $ret
fi
echo " done."
echo "Converting from CSV format to KEYVALUEJSON"
python csv-to-json.py --csv $CSV_FILE_PATH --json $JSON_FILE_PATH
ret=$?
if [ $ret -ne 0 ]; then
echo "Failed to convert CSV file to JSON format: $ret"
exit $ret
fi
echo "Uploading source strings to Transifex..."
tx push -s -r ooni-run.website
ret=$?
if [ $ret -ne 0 ]; then
echo "Failed to upload source strings."
exit $ret
fi
echo "✅ Uploaded source strings to Transifex."