-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtx-configure.sh
executable file
·94 lines (73 loc) · 2.37 KB
/
tx-configure.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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#!/bin/bash
#-This is a bash script for use with transifex
#-==============================================================================
#- tx-configure.sh
#-
#- Author : Isaías Gatjens M - Twitter @igatjens
#- Version : v0.2
#- License : Distributed under the terms of GNU GPL version 2 or later
#-
#-
#- notes :
#-==============================================================================
#Comprobar si pip, git y tx están instalados - #Check if pip, git and tx are installed
if [[ -z $(which pip) ]]; then
#statements
echo "The pip command is necessary to configure translations."
echo "Install pip with the following command."
echo "sudo apt install python-pip"
exit 1
fi
if [[ -z $(which git) ]]; then
#statements
echo "The git command is necessary to configure translations."
echo "Install git with the following command."
echo "sudo apt install git"
exit 1
fi
if [[ -z $(which tx) ]]; then
#statements
echo "The tx command is necessary to configure translations."
echo "Install tx with the following command."
echo "sudo pip install transifex-client"
exit 1
fi
#Eliminar lineas en blando de projects.conf - #Remove blank lines from projects.conf
sed -i '/^ *$/d' projects.conf
#Hacer una lista de los proyectos - #Make a list of projects
PROJECTS_URL=()
PROJECTS_NAME=()
COUNTER=1
for i in $( cat projects.conf | cut -d "=" -f 2 | sed "s| *||g" ); do
PROJECTS_URL[COUNTER]=$i
#echo ${PROJECTS_URL[COUNTER]}
let COUNTER+=1
done
echo ""
echo "======================================="
echo "Configured projects"
COUNTER=1
for i in $( cat projects.conf | cut -d "=" -f 1 | sed -e "s| |_|g" -e "s|_$||g" ); do
PROJECTS_NAME[COUNTER]=$i
echo ${PROJECTS_NAME[COUNTER]}
let COUNTER+=1
done
PROJECTS_QUANTITY=${#PROJECTS_NAME[@]}
echo ""
echo "Total projects: "$PROJECTS_QUANTITY
echo "======================================="
echo ""
#Iniciar cuenta de transifex - #Init transifex account
tx init --skipsetup
#Configurar cada uno de los proyectos - #Configure each of the projects
for ((i=1; i <= PROJECTS_QUANTITY; i++)); do
echo ""
echo "======================================="
echo "Configuring project "$i of $PROJECTS_QUANTITY"..."
echo ${PROJECTS_NAME[i]}
echo ${PROJECTS_URL[i]}
echo "======================================="
echo ""
#Configurar proyecto - #Configure project
tx config mapping-remote ${PROJECTS_URL[i]}
done