aboutsummaryrefslogtreecommitdiffstats
path: root/crowdin/upload
blob: b7010ea7fc8382eb6ded32d2aa370ff1c32569d7 (plain)
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
#/bin/sh

#
#
# This script uploads 
#   main/res/values-xx/strings.xml
#   cgeo-calendar/res/values-xx/strings.xml
#   cgeo-contacts/res/values-xx/strings.xml
# in crowdin by uploading the files from the current branch to crowdin.
#
#

# see: 

# upload_file uploads the file in parameter 1 to the crowdin file name in parameter 2 
upload_file() {
    if [ -f "$2" ]; then
        CROWDIN_LANG=$(map_to_crowdin_code "$1")
        crowdin_surf \
            -F \"files[$3]=@$2\" \
            -F \"language=$CROWDIN_LANG\" \
            -F \"import_eq_suggestions=1\" \
            \"http://api.crowdin.net/api/project/cgeo/upload-translation?key=${CROWDIN_APIKEY}\"
    else
        debug "$2 not found."
    fi
}

. "$(dirname $0)/globals"

if [ $# -eq 0 ]; then
    debug "no languages passed - aborting."
fi

for i in $@; do
    upload_file $i main/res/values-$i/strings.xml /cgeo/strings.xml
    upload_file $i cgeo-calendar/res/values-$i/strings.xml /cgeo-calendar/strings.xml
    upload_file $i cgeo-contacts/res/values-$i/strings.xml /cgeo-contacts/strings.xml
done