From 227a88f14571b3945ce6f622b20ee21e4f6f8664 Mon Sep 17 00:00:00 2001 From: Aleksandr Grenishin Date: Wed, 15 May 2024 12:43:31 +0300 Subject: [PATCH] fix(l10n): add l10n key to the state if it's not present (#656) Co-authored-by: nd0ut --- abstract/l10nProcessor.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/abstract/l10nProcessor.js b/abstract/l10nProcessor.js index 87cef5cd1..43076a19f 100644 --- a/abstract/l10nProcessor.js +++ b/abstract/l10nProcessor.js @@ -47,6 +47,10 @@ export function l10nProcessor(fr, fnCtx) { ); // We don't need the leading * in the key because we use the key as a local context key relative to the global state const nodeStateKey = localeStateKey(mappedKey).replace('*', ''); + // If the key is not present in the node context, add it + if (!fnCtx.nodeCtx.has(nodeStateKey)) { + fnCtx.nodeCtx.add(nodeStateKey, mappedKey); + } // Subscribe on the global l10n key change const sub = fnCtx.nodeCtx.sub(nodeStateKey, () => { el[/** @type {'textContent'} */ (elProp)] = fnCtx.l10n(mappedKey);