forked from home-assistant/core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
translations_upload
executable file
·44 lines (35 loc) · 1.44 KB
/
translations_upload
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
#!/usr/bin/env bash
# Safe bash settings
# -e Exit on command fail
# -u Exit on unset variable
# -o pipefail Exit if piped command has error code
set -eu -o pipefail
cd "$(dirname "$0")/.."
if [ -z "${LOKALISE_TOKEN-}" ] && [ ! -f .lokalise_token ] ; then
echo "Lokalise API token is required to download the latest set of" \
"translations. Please create an account by using the following link:" \
"https://lokalise.co/signup/130246255a974bd3b5e8a1.51616605/all/" \
"Place your token in a new file \".lokalise_token\" in the repo" \
"root directory."
exit 1
fi
# Load token from file if not already in the environment
[ -z "${LOKALISE_TOKEN-}" ] && LOKALISE_TOKEN="$(<.lokalise_token)"
PROJECT_ID="130246255a974bd3b5e8a1.51616605"
LOCAL_FILE="$(pwd)/build/translations-upload.json"
LANG_ISO=en
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
if [ "${CURRENT_BRANCH-}" != "dev" ] && [ "${TRAVIS_BRANCH-}" != "dev" ] ; then
echo "Please only run the translations upload script from a clean checkout of dev."
exit 1
fi
script/translations_upload_merge.py
docker run \
-v ${LOCAL_FILE}:/opt/src/${LOCAL_FILE} \
lokalise/lokalise-cli@sha256:2198814ebddfda56ee041a4b427521757dd57f75415ea9693696a64c550cef21 lokalise \
--token ${LOKALISE_TOKEN} \
import ${PROJECT_ID} \
--file /opt/src/${LOCAL_FILE} \
--lang_iso ${LANG_ISO} \
--convert_placeholders 0 \
--replace 1