import re, json, os
base = '/home/szymon/projects/tfb/app/panel'
with open(f'{base}/views/document/invoice/generated.twig') as f:
    content = f.read()
for key in ['b', 'all', 'actions', 'deferral_invoice', 'receipts', 'sent_peppol', 'specific_date', 'unpaid']:
    pattern = r'translations\.' + key + r'\b'
    matches = list(re.finditer(pattern, content))
    line_nums = [content[:m.start()].count('\n')+1 for m in matches]
    print(f"KEY '{key}': found {len(matches)} times at lines {line_nums}")
print("\n--- All unique keys ---")
all_keys = sorted(set(re.findall(r'translations\.([a-zA-Z_]+)', content)))
for k in all_keys:
    print(k)
print(f"TOTAL: {len(all_keys)}")
