#!/bin/sh
#
# Check that known typos are not found in dictionary
#
# (c) 2019 Roland Rosenfeld <roland@debian.org>

# case sensitive:
TYPOS="Aour seperation Gie0erei Behalter äußester changable Pirmarschule Stehgreif Verländerungsschnüre vornehemn"

# case insensitive:
TYPOSi="managment"

# Dictionary to test:
DICT=/usr/share/trans/de-en

FOUND=""

for i in $TYPOS
do
    if grep -q "$i" "$DICT"
    then
	FOUND="$i $FOUND"
    fi
done

for i in $TYPOSi
do
    if grep -qi "$i" "$DICT"
    then
	FOUND="$i $FOUND"
    fi
done

if [ -z "$FOUND" ]
then
    exit 0
else
    echo "Found following typos in $DICT:"
    echo "$FOUND"
    exit 1
fi
