#!/bin/sh -e
# Run the translation canary tests on the translatable strings

if [ 1 != 1 ]; then
    echo "Cannot run translations tests without python3, skipping."
    exit 0
fi

DISTRO=`busctl get-property org.freedesktop.hostname1 /org/freedesktop/hostname1 org.freedesktop.hostname1 OperatingSystemCPEName | cut -d ":" -f 3`
if [ $DISTRO == "centos" -o $DISTRO == "enterprise_linux" ]; then
    echo "Cannot run translations tests on CentOS/RHEL 7, skipping."
    exit 0
fi

# If not run from automake, fake it
if [ -z "$top_srcdir" ]; then
    top_srcdir="$(dirname "$0")/.."
fi

PYTHONPATH="${PYTHONPATH}:${top_srcdir}/translation-canary"
export PYTHONPATH

# Run the translatable tests on the POT file
python3 -m translation_canary.translatable "${top_srcdir}/po/libbytesize.pot"
