Skip to content

Add workflow to validate translation files #1

Add workflow to validate translation files

Add workflow to validate translation files #1

name: Validate translations
on:
push:
pull_request:
jobs:
check-it-translation:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install jq
run: sudo apt-get update && sudo apt-get install -y jq
- name: Validate it.json syntax
run: |
jq . custom_components/weishaupt_modbus/translations/it.json > /dev/null
- name: Check that it.json contains all keys from en.json
run: |
EN_KEYS=$(jq -r 'paths | map(tostring) | join(".")' custom_components/weishaupt_modbus/translations/en.json | sort)
IT_KEYS=$(jq -r 'paths | map(tostring) | join(".")' custom_components/weishaupt_modbus/translations/it.json | sort)
MISSING=$(comm -23 <(echo "$EN_KEYS") <(echo "$IT_KEYS"))
if [ -n "$MISSING" ]; then
echo "❌ Chiavi mancanti in it.json:"
echo "$MISSING"
exit 1
fi
echo "✅ Tutte le chiavi di en.json sono presenti in it.json"