forked from binary-com/binary-static
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupdate_translations.sh
executable file
·76 lines (64 loc) · 1.95 KB
/
update_translations.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
69
70
71
72
73
74
75
76
#!/bin/sh
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[0;33m'
WHITE='\033[1;37m'
RESET='\033[0m'
if ! [ -x "$(command -v crowdin)" ]; then
if [ -f /usr/local/bin/crowdin-cli.jar ]; then
alias crowdin="java -jar /usr/local/bin/crowdin-cli.jar"
else
echo ${YELLOW}"crowdin-cli not found. Please follow the instructions here: https://support.crowdin.com/cli-tool/#installation"${RESET}
exit 1
fi
fi
if [[ $(git config --get remote.origin.url) =~ (binary-com|binary-static-deployed)/binary-static ]]; then
echo ${RED}" > ERROR: "${RESET}"remote 'origin' should be your fork."
exit 1
fi
function message {
echo ${GREEN}" >"${RESET} $1
}
function confirm {
read -p "$(echo "\n${WHITE}$1 ${RESET}(y/n)${YELLOW}") " -n 1 -r &&
echo "${RESET}"
}
cd $(git rev-parse --show-toplevel) &&
message "Updating master branch" &&
git checkout master &&
git fetch upstream master &&
git reset --hard upstream/master &&
confirm "Update the source file (messages.pot) and push to Crowdin?" &&
if [[ $REPLY =~ ^[Yy]$ ]]
then
message "Updating translations source file" &&
./scripts/render.js -t &&
message "Uploading source file to Crowdin"
crowdin upload sources
fi &&
confirm "Download translation files and update javascript texts?" &&
if [[ $REPLY =~ ^[Yy]$ ]]
then
message "Downloading translation files from Crowdin (*.po)" &&
crowdin download &&
message "Updating javascript translation files (*.js)"
./scripts/render.js -j
fi &&
confirm "Commit changes and push to origin?" &&
if [[ $REPLY =~ ^[Yy]$ ]]
then
cd $(git rev-parse --show-toplevel) &&
message "Committing"
git commit -a -m "Update translations" &&
message "Pushing"
git push origin master
fi &&
echo ${GREEN}"\nSuccessfully Done." &&
if [[ $REPLY =~ ^[Yy]$ ]]
then
confirm "Open github to submit the PR?" &&
if [[ $REPLY =~ ^[Yy]$ ]]
then
open "https://github.com/binary-com/binary-static"
fi
fi