Skip to content

docs: cover the runtime macro and default variables - #14

Merged
andrii-bodnar merged 1 commit into
mainfrom
docs/runtime-macro-default-variables
Oct 20, 2026
Merged

andrii-bodnar merged 1 commit into
mainfrom
docs/runtime-macro-default-variables

Conversation

@andrii-bodnar

Copy link
Copy Markdown
Contributor

Lingui 6.10.0 added two features that lingui-best-practices didn't mention: the experimental runtime macro (@lingui/core/runtime-macro) for code with no build step, and default message variables (i18n.setVariables).

  • Runtime macro: the macro decision tree now says it assumes a build-time transform, and points code with no build step (Node.js scripts, serverless functions, test runners) to a new integration recipe. The recipe covers what differs from the compile-time macros: named placeholders, plural/select inside msg, nested msg for option placeholders, i18n._ to resolve, and experimental.runtimeMacro for extraction. It is marked experimental.
  • Default variables: a new "App-wide Values in Messages" pattern: register a value such as the product name once and write the placeholder bare. It covers which value wins, the silent empty output for an unset name, and when components re-render.

Tested: claude plugin validate . and claude plugin validate skills --strict. Ran every runtime macro example and the default-variable behavior in Node against @lingui/core 6.10, and the bare-placeholder forms through the Babel macro plugin.

Lingui 6.10.0 added an experimental runtime macro
(@lingui/core/runtime-macro) for code with no build step, and default
message variables (i18n.setVariables / setupI18n({ variables })).
lingui-best-practices mentioned neither.

- The macro decision tree now says it assumes a build-time transform
  and points code with no build step to a new integration recipe: the
  runtime macro, with the rules that differ from the compile-time
  macros (named placeholders, choice helpers inside msg, nested msg for
  option placeholders, i18n._ to resolve, experimental.runtimeMacro for
  extraction).
- Common Patterns gains "App-wide Values in Messages": register a value
  once, write the placeholder bare, plus precedence, the silent empty
  render for unset names, and re-render behavior.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@andrii-bodnar
andrii-bodnar merged commit 2755b31 into main Oct 20, 2026
1 check passed
@andrii-bodnar
andrii-bodnar deleted the docs/runtime-macro-default-variables branch October 20, 2026 06:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant