1
mirror of https://github.com/home-assistant/frontend synced 2024-08-19 13:25:07 +02:00
ha-frontend/script/translations_upload_base
Adam Mills e719f113d9 Fix for Lokalise backend misinterpretation of keys (#1107)
The Lokalise server has a bug that the internal portion of key
references was misinterpreted as a symfony key, and was getting auto
converted by the convert placeholders feature. Since we don't use this
we're turning it off to work around the bug.
2018-04-18 14:11:03 -04:00

43 lines
1.4 KiB
Bash
Executable File

#!/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/3420425759f6d6d241f598.13594006/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="3420425759f6d6d241f598.13594006"
LOCAL_FILE="$(pwd)/src/translations/en.json"
LANG_ISO=en
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
if [ "${CURRENT_BRANCH-}" != "master" ] && [ "${TRAVIS_BRANCH-}" != "master" ] ; then
echo "Please only run the translations upload script from a clean checkout of master."
exit 1
fi
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