forked from igatjens/transifex-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtx-configure.sh
executable file
·76 lines (59 loc) · 1.97 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
#!/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 tx está instalado - #Check if tx is installed
if [[ -z $(which tx) ]]; then
#statements
echo "The tx command is necessary to configure translations."
echo "Install tx with the following command."
echo "curl -o- https://raw.githubusercontent.com/transifex/cli/master/install.sh | bash"
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
#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 add remote ${PROJECTS_URL[i]}
done