aboutsummaryrefslogtreecommitdiffstats
path: root/crowdin
diff options
context:
space:
mode:
Diffstat (limited to 'crowdin')
-rwxr-xr-xcrowdin/download10
-rwxr-xr-xcrowdin/globals13
-rwxr-xr-xcrowdin/update2
-rwxr-xr-xcrowdin/upload4
4 files changed, 15 insertions, 14 deletions
diff --git a/crowdin/download b/crowdin/download
index 7465ad3..b6bbe40 100755
--- a/crowdin/download
+++ b/crowdin/download
@@ -10,12 +10,12 @@
# see: http://crowdin.net/page/api/export
# see: http://crowdin.net/page/api/download
-. "`dirname $0`/globals"
+. "$(dirname $0)/globals"
BRANCH=crowdin_translations
GITHUB_PR_TITLE="crowdin: New translations"
PR_EXISTS=0
-DDATE=`date +"%Y-%m-%d %H:%M:%S"`
+DDATE=$(date +"%Y-%m-%d %H:%M:%S")
ZIPFILE=all.zip
# default base branch
BASE_BRANCH=master
@@ -76,10 +76,10 @@ for f in */*/*values-*/strings.xml; do
done
# apply local patches to particular strings
-. "`dirname $0`/local-patches"
+. "$progdir/local-patches"
# check for changes
-if [ -z "`git diff`" ]; then
+if [ -z "$(git diff)" ]; then
debug "no changes, finishing."
finish
exit
@@ -87,7 +87,7 @@ fi
# upload changes to github
AMEND=""
-[[ ! -z "`git log ${BASE_BRANCH}..${BRANCH}`" ]] && AMEND="--amend"
+[[ ! -z "$(git log ${BASE_BRANCH}..${BRANCH})" ]] && AMEND="--amend"
_do git commit -a "${AMEND}" -m \"${GITHUB_PR_TITLE}\" || die "commit failed."
_do git push -f origin "${BRANCH}" || die "git push failed."
diff --git a/crowdin/globals b/crowdin/globals
index dc2e9c9..80f7e83 100755
--- a/crowdin/globals
+++ b/crowdin/globals
@@ -1,8 +1,10 @@
#!/bin/bash
-. "`dirname $0`/credentials"
+progdir=$(cd $(dirname "$0") && pwd)
-OUT=/tmp/crowdin.`basename $0`.`date +%Y-%m-%d.%H:%M:%S`.out
+. "$progdir/credentials"
+
+OUT=/tmp/crowdin.$(basename $0).$(date +%Y-%m-%d.%H:%M:%S).out
crowdin_surf () {
_do curl -o "${OUT}" $@ || die "curl produced an error."
@@ -15,7 +17,7 @@ require_tools () {
# code taken from backup2l
local NOT_AVAIL=""
for TOOL in $@; do
- if [ "`which $TOOL 2> /dev/null`" == "" ]; then NOT_AVAIL="$NOT_AVAIL $TOOL"; fi
+ if [ "$(which $TOOL 2> /dev/null)" == "" ]; then NOT_AVAIL="$NOT_AVAIL $TOOL"; fi
done
if [[ "$NOT_AVAIL" != "" ]]; then
die "The following required tool(s) cannot be found: $NOT_AVAIL"
@@ -32,7 +34,7 @@ map_to_crowdin_code () {
finish () { : ; }
die () { for i; do debug "$i"; done; finish; exit 1; }
-debug () { echo "`date +%Y-%m-%d.%H:%M:%S` `basename $0`: $@"; }
+debug () { echo $(date +%Y-%m-%d.%H:%M:%S) $(basename $0): $@; }
# use this function for executing commands.
_do () { debug "$@"; eval "$@"; }
@@ -40,5 +42,4 @@ _do () { debug "$@"; eval "$@"; }
require_tools git curl wget unzip sed
git rev-parse --show-toplevel >& /dev/null || die "Please start this script from within a repo. Aborting."
-cd "`git rev-parse --show-toplevel`"
-
+cd "$(git rev-parse --show-toplevel)"
diff --git a/crowdin/update b/crowdin/update
index 984b62f..757e948 100755
--- a/crowdin/update
+++ b/crowdin/update
@@ -18,7 +18,7 @@ update_file() {
"http://api.crowdin.net/api/project/cgeo/update-file?key=${CROWDIN_APIKEY}"
}
-. "`dirname $0`/globals"
+. "$(dirname $0)/globals"
echo You must be on an up-to-date master branch to execute this script.
echo You have 5 seconds to abort with ctrl-c if this is not the case.
diff --git a/crowdin/upload b/crowdin/upload
index 547989e..b7010ea 100755
--- a/crowdin/upload
+++ b/crowdin/upload
@@ -15,7 +15,7 @@
# 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_LANG=$(map_to_crowdin_code "$1")
crowdin_surf \
-F \"files[$3]=@$2\" \
-F \"language=$CROWDIN_LANG\" \
@@ -26,7 +26,7 @@ upload_file() {
fi
}
-. "`dirname $0`/globals"
+. "$(dirname $0)/globals"
if [ $# -eq 0 ]; then
debug "no languages passed - aborting."