indexTranslations function
The wrapper for one catalog — hand it to whatever seam the project's translations expose.
widget = TranslationOverride(wrapper: indexTranslations('app'), child: app);
The signature is String Function(String key, String value) because that is
what a catalog's own hook already looks like wherever one exists. What
comes back is == the value and renders identically; it is simply a
distinct object, which is what lets a capture name the key.
Cached per catalog, so repeated calls hand back the same closure. An
InheritedWidget carrying this will compare wrappers in
updateShouldNotify, and a fresh closure per build would notify every
dependent on every rebuild.
Implementation
String Function(String key, String value) indexTranslations(String catalog) =>
TranslationIndex._wrappers[catalog] ??= (key, value) =>
TranslationIndex.record(catalog, key, value);