#!/bin/sh

# This script wraps i18next-conv. It does not work with STDIN / STDOUT.

set -euo pipefail

if [ -z "$1" ] || [ -z "$2" ]; then
    echo "Usage: $0 PATH-TO-I18NEXT-CONV LANGCODE"
    exit 1
fi

tempdir=`mktemp --directory`
cat - > "$tempdir/input.po"
$1 --language $2 --source "$tempdir/input.po" --target "$tempdir/output.json"
cat "$tempdir/output.json"
