@@ -59,7 +59,11 @@ def build_report(
5959 en_total = len (en_keys )
6060 detected_total = len (used_keys )
6161 gap = en_total - detected_total
62- status = "✅ All detected keys are present in `en.json`" if not missing else f"❌ { len (missing )} key(s) missing from `en.json`"
62+ status = (
63+ "✅ All detected keys are present in `en.json`"
64+ if not missing
65+ else f"❌ { len (missing )} key(s) missing from `en.json`"
66+ )
6367
6468 lines = [
6569 "## Frontend i18n Key Coverage Report" ,
@@ -70,8 +74,8 @@ def build_report(
7074 "" ,
7175 "### Summary" ,
7276 "" ,
73- f "| Metric | Count |" ,
74- f "|--------|-------|" ,
77+ "| Metric | Count |" ,
78+ "|--------|-------|" ,
7579 f"| Keys in `en.json` | { en_total } |" ,
7680 f"| Statically detected `t()` keys in source | { detected_total } |" ,
7781 f"| Keys in source missing from `en.json` | { len (missing )} |" ,
@@ -101,19 +105,19 @@ def build_report(
101105 "" ,
102106 "### ℹ️ Why `en.json` has more keys than detected in source" ,
103107 "" ,
104- " The static analysis only counts hardcoded `t(\ " some.key\ " )` string literals." ,
108+ ' The static analysis only counts hardcoded `t("some.key")` string literals.' ,
105109 f"`en.json` has { en_total } keys while the scanner detected { detected_total } — a gap of { gap } . This is expected for three reasons:" ,
106110 "" ,
107111 "**1. Pluralization suffixes**" ,
108112 "" ,
109113 "i18next requires separate keys for singular/plural forms. When you write:" ,
110114 "```ts" ,
111- "t( \ " alerts.modelsRefreshed\ " , { count })" ,
115+ 't( "alerts.modelsRefreshed", { count })' ,
112116 "```" ,
113117 "The source has one key, but `en.json` needs two:" ,
114118 "```json" ,
115- " \" alerts.modelsRefreshed_one\ " : \ " {{count}} model refreshed\" ," ,
116- " \" alerts.modelsRefreshed_other\ " : \ " {{count}} models refreshed\" " ,
119+ '" alerts.modelsRefreshed_one": "{{count}} model refreshed",' ,
120+ '" alerts.modelsRefreshed_other": "{{count}} models refreshed"' ,
117121 "```" ,
118122 "" ,
119123 "**2. Dynamic keys**" ,
@@ -179,7 +183,9 @@ def main() -> int:
179183 # Always print a summary to stdout
180184 if not missing :
181185 print (f"✓ All { len (used_keys )} detected i18n keys found in en.json" )
182- print (f" (en.json has { len (en_keys )} total keys; gap of { len (en_keys ) - len (used_keys )} is expected — see report for details)" )
186+ print (
187+ f" (en.json has { len (en_keys )} total keys; gap of { len (en_keys ) - len (used_keys )} is expected — see report for details)"
188+ )
183189 else :
184190 print (f"✗ { len (missing )} key(s) used in source but missing from en.json:\n " )
185191 for key , locations in sorted (missing .items ()):
0 commit comments