Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

608 B
Raw Blame
#!/usr/bin/env bash

set -euo pipefail
source "$(dirname "${BASH_SOURCE[0]}")/common.sh"

pin=$(i18n_pin "${1:-}")
destination=$(i18n_snapshot "$pin")

if [ ! -d "$destination" ]; then
  mkdir -p "$I18N_CACHE"
  workspace=$(mktemp -d "$I18N_CACHE/fetch.XXXXXX")
  trap 'rm -rf "$workspace"' EXIT
  i18n_download "$pin" "$workspace/locales"
  chmod a-w "$workspace/locales/"*.po
  for snapshot in "$I18N_CACHE"/*; do
    if [[ "$(basename "$snapshot")" =~ ^(latest|v[0-9]+)-[0-9a-f]{40}$ ]]; then
      rm -rf "$snapshot"
    fi
  done
  mv "$workspace/locales" "$destination"
fi
printf '%s\n' "$destination"