build: i18n file download time with millisecond precision
This commit is contained in:
parent
52cfeee2b1
commit
e57e19c9f1
|
@ -29,17 +29,20 @@ I18N_REPO_BRANCH="v$(./pkg-vsn.sh "${PROFILE_STR}" | tr -d '.' | cut -c 1-2)"
|
||||||
|
|
||||||
DOWNLOAD_I18N_TRANSLATIONS=${DOWNLOAD_I18N_TRANSLATIONS:-true}
|
DOWNLOAD_I18N_TRANSLATIONS=${DOWNLOAD_I18N_TRANSLATIONS:-true}
|
||||||
# download desc (i18n) translations
|
# download desc (i18n) translations
|
||||||
|
beginfmt='\033[1m'
|
||||||
|
endfmt='\033[0m'
|
||||||
if [ "$DOWNLOAD_I18N_TRANSLATIONS" = "true" ]; then
|
if [ "$DOWNLOAD_I18N_TRANSLATIONS" = "true" ]; then
|
||||||
echo "downloading i18n translation from emqx/emqx-i18n"
|
echo "Downloading i18n translation from emqx/emqx-i18n..."
|
||||||
start=$(date +%s)
|
start=$(date +%s%N)
|
||||||
curl -L --fail --silent --show-error \
|
curl -L --fail --silent --show-error \
|
||||||
--output "apps/emqx_dashboard/priv/desc.zh.hocon" \
|
--output "apps/emqx_dashboard/priv/desc.zh.hocon" \
|
||||||
"https://raw.githubusercontent.com/emqx/emqx-i18n/${I18N_REPO_BRANCH}/desc.zh.hocon"
|
"https://raw.githubusercontent.com/emqx/emqx-i18n/${I18N_REPO_BRANCH}/desc.zh.hocon"
|
||||||
end=$(date +%s)
|
end=$(date +%s%N)
|
||||||
duration=$(echo "$end $start" | awk '{print $1 - $2}')
|
duration=$(echo "$end $start" | awk '{printf "%.f\n", (($1 - $2)/ 1000000)}')
|
||||||
echo "downloaded i18n translation in $duration seconds, set DOWNLOAD_I18N_TRANSLATIONS=false to skip"
|
if [ "$duration" -gt 1000 ]; then beginfmt='\033[1;33m'; fi
|
||||||
|
echo -e "Downloaded i18n translation in $duration milliseconds.\nSet ${beginfmt}DOWNLOAD_I18N_TRANSLATIONS=false${endfmt} to skip"
|
||||||
else
|
else
|
||||||
echo "skipping to download i18n translation from emqx/emqx-i18n, set DOWNLOAD_I18N_TRANSLATIONS=true to update"
|
echo -e "Skipping to download i18n translation from emqx/emqx-i18n.\nSet ${beginfmt}DOWNLOAD_I18N_TRANSLATIONS=true${endfmt} to update"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# TODO
|
# TODO
|
||||||
|
|
Loading…
Reference in New Issue