indexExpansions function
The same seam again, for a string the catalog built rather than stored.
A value that goes through a placeholder — 'Thanks {name}' becoming
'Thanks Ada' — is a new object, so the token indexTranslations handed
out is not what renders and identity has nothing to match. The fix is to
route the key rather than infer it: whatever performed the substitution knew
the key microseconds earlier, and reporting it is exact where reading the
words back would be a guess.
It belongs beside the substitution, which in a loader-based catalog is one method rather than a call site:
static String Function(String key, String expanded)? wrapExpanded;
String thanks(String name) =>
_expand('thanks', read('thanks').replaceAll('{name}', name));
One key may expand many ways in one run — a different name per fixture — and each gets its own token pointing back at the same key, so the panel sees several occurrences and picks the best one to photograph.
Unlike indexTranslations this does not add to TranslationIndex.read: that map is what each catalog answered, which the export compares against the locale's file, and an expansion never equals the file's value.
Implementation
String Function(String key, String expanded) indexExpansions(String catalog) =>
TranslationIndex._expansions[catalog] ??= (key, expanded) =>
TranslationIndex.record(catalog, key, expanded, expansion: true);