You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
@wxt-dev/i18n: named substitutions treat mustache-style {{tokens}} as required i18n arguments #2482
0.2.6 (latest on npm at the time of filing). This appears to be a regression from 0.2.5, which did not have the named substitution scanner, runtime support, or type overloads.
Description
0.2.6 introduced named substitutions using {name} placeholders. The generated type scanner also detects placeholders inside mustache-style application templates such as {{targetLanguage}}.
That makes messages containing app-level template tokens require named i18n substitutions even when the desired behavior is to retrieve the localized template string unchanged and store or use it later.
In our extension, these strings are custom AI prompt templates. The {{...}} tokens are intentionally preserved and substituted later by our own prompt renderer, not by i18n at template creation time.
Reproduction
Locale file:
actionTemplate:
prompt: |- Translate {{selection}} into {{targetLanguage}}.
Argument of type "actionTemplate.prompt" is not assignable to parameter of type never.
because the no-argument overload excludes keys with namedSubstitutions.
Expected Behavior
It should be possible to include literal or app-level brace templates in localized strings without forcing them to become @wxt-dev/i18n named substitutions.
Possible fixes:
Do not treat {{name}} as a named substitution, only single-brace {name}.
Or provide a documented escape syntax for literal braces or template tokens that is respected by both runtime substitution and generated types.
Actual Behavior
{{name}} is detected as {name}, so the generated types require a named substitution object. This is surprising for applications that already use double-brace template tokens and only want i18n to return the raw localized template text.
Workaround
Passing the token back through named substitutions can preserve the string, for example:
Activity