Skip to content

Instantly share code, notes, and snippets.

@cedricbonhomme
Last active May 11, 2021 19:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cedricbonhomme/4d0bc78bb9e2382156f88f33bf33cc05 to your computer and use it in GitHub Desktop.
Save cedricbonhomme/4d0bc78bb9e2382156f88f33bf33cc05 to your computer and use it in GitHub Desktop.
check-translations.sh
#!/bin/bash
# Defore executing this script you must install curl and jq:
# sudo apt-get install curl jq
set -e
# database user:
USER="sqlmonarcuser"
# database password
PASSWORD="sqlmonarcuser"
LANGUAGE="EN"
RED='\033[0;31m'
GREEN='\033[0;32m'
NC='\033[0m' # No Color
for object in assets threats vulnerabilities
do
echo -e "Missing translations for $RED$object$NC:"
mysql -u $USER -p$PASSWORD monarc_common -e "SELECT label1 FROM $object WHERE (label2 is null or label2 = '')" | sed -n '1!p' | while read line
do
if [ "$line" ]
then
echo $line;
fi
done
echo ""
done
echo "=============="
for object in themes measures rolf_risks rolf_tags objects_categories questions questions_choices models soacategory scales_impact_types
do
echo -e "Missing translations for $RED$object$NC:"
mysql -u $USER -p$PASSWORD monarc_common -e "SELECT label1 FROM $object WHERE (label2 is null or label2 = '')" | sed -n '1!p' | while read line
do
if [ "$line" ]
then
echo $line;
fi
done
echo ""
done
echo "=============="
for object in objects instances
do
echo -e "Missing translations for $RED$object$NC:"
mysql -u $USER -p$PASSWORD monarc_common -e "SELECT label1 FROM $object WHERE (label2 is null or label2 = '' or name2 is null or name2 = '')" | sed -n '1!p' | while read line
do
if [ "$line" ]
then
echo $line;
fi
done
echo ""
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment