Migrate to Lokalise for managing translations (#555)
This commit is contained in:
committed by
Paulus Schoutsen
parent
551cbe5afa
commit
fdf2fa3d3f
@@ -11,6 +11,10 @@ OUTPUT_DIR=hass_frontend
|
||||
rm -rf $OUTPUT_DIR
|
||||
cp -r public $OUTPUT_DIR
|
||||
|
||||
# Download latest translations
|
||||
echo "Downloading translations from Lokalise"
|
||||
script/translations_download
|
||||
|
||||
# Build frontend
|
||||
BUILD_DEV=0 ./node_modules/.bin/gulp
|
||||
|
||||
|
||||
Executable
+37
@@ -0,0 +1,37 @@
|
||||
#!/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 [ ! -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/"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
API_TOKEN="$(<.lokalise_token)"
|
||||
PROJECT_ID="3420425759f6d6d241f598.13594006"
|
||||
LOCAL_DIR="$(pwd)/translations"
|
||||
DOWNLOAD_FILE="${LOCAL_DIR}/Home_Assistant_-_Polymer_frontend-locale.zip"
|
||||
FILE_FORMAT=json
|
||||
|
||||
rm -rf ${LOCAL_DIR}
|
||||
mkdir -p ${LOCAL_DIR}
|
||||
|
||||
docker run \
|
||||
-v ${LOCAL_DIR}:/opt/dest \
|
||||
lokalise/lokalise-cli lokalise \
|
||||
--token ${API_TOKEN} \
|
||||
export ${PROJECT_ID} \
|
||||
--type json \
|
||||
--dest /opt/dest
|
||||
|
||||
# Extract and delete downloaded zip bundle
|
||||
unzip -j "${DOWNLOAD_FILE}" locale/* -d "${LOCAL_DIR}"
|
||||
rm -f "${DOWNLOAD_FILE}"
|
||||
Executable
+29
@@ -0,0 +1,29 @@
|
||||
#!/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 [ ! -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/"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
API_TOKEN="$(<.lokalise_token)"
|
||||
PROJECT_ID="3420425759f6d6d241f598.13594006"
|
||||
LOCAL_FILE="$(pwd)/src/translations/en.json"
|
||||
LANG_ISO=en
|
||||
|
||||
docker run \
|
||||
-v ${LOCAL_FILE}:/opt/src/${LOCAL_FILE} \
|
||||
lokalise/lokalise-cli lokalise \
|
||||
--token ${API_TOKEN} \
|
||||
import ${PROJECT_ID} \
|
||||
--file /opt/src/${LOCAL_FILE} \
|
||||
--lang_iso ${LANG_ISO}
|
||||
Reference in New Issue
Block a user