fix(i18n): align stack after phrase key rollout

This commit is contained in:
Sam Potts
2026-07-13 08:22:40 +10:00
parent 1080f5fb19
commit cfb20fb134
21 changed files with 126 additions and 128 deletions
@@ -1,13 +1,13 @@
/**
* Loads overlay layers for each tag in {@link localeLookupChain}, least-specific first, then merges
* Loads overlay layers for each resolved locale key, least-specific first, then merges
* most-specific-last (same semantics as the core i18n registry).
*/
export async function mergeLocaleOverlays<Overlay extends object>(
locale: string,
load: (tag: string) => Promise<Partial<Overlay> | undefined>,
localeLookupChain: (locale: string) => string[]
findKeys: (locale: string) => string[]
): Promise<{ merged: Partial<Overlay>; loadedTags: string[] }> {
const chain = localeLookupChain(locale);
const chain = findKeys(locale);
const layers = await Promise.all(chain.map((tag) => load(tag)));
const loadedTags: string[] = [];
const merged: Partial<Overlay> = {};