#!/usr/bin/env python3 import json import sys with open('/Users/treyt/Desktop/code/Feels/Feels/Localizable.xcstrings', 'r') as f: d = json.load(f) strings = d.get('strings', {}) # Get strings that need translation missing = [] for key, val in strings.items(): if not key.strip(): continue localizations = val.get('localizations', {}) # Check if German has a translation if 'de' not in localizations: missing.append(key) elif 'stringUnit' in localizations.get('de', {}): state = localizations['de']['stringUnit'].get('state', '') if state != 'translated': missing.append(key) # Print all missing strings print("Missing translations:") for s in missing: print(repr(s)) print(f'\nTotal missing: {len(missing)}')