#!/bin/bash

# Updates the translation source file of the given language and opens linguist.

if [[ ! "$1" ]]; then
    echo "Usage: $0 [LANG]"
    exit 1
fi

LANG=$1

LUPDATE=lupdate
if ! which ${LUPDATE}; then
    echo "${LUPDATE} not found."
    exit 1
fi

LINGUIST=linguist
if ! which ${LINGUIST}; then
    echo "${LINGUIST} not found."
    exit 1
fi

echo "Updating files for ${LANG}"

TS_FILE=src/translations/heimer_${LANG}.ts
${LUPDATE} src/*.cpp -ts ${TS_FILE}

echo "Opening ${LINGUIST}.."

${LINGUIST} ${TS_FILE}

echo "Done."

