From 755ad83443f2aa481d233cd776fe94fac0c318e4 Mon Sep 17 00:00:00 2001 From: Kevin Liu Date: Sat, 10 Oct 2026 15:53:34 -0700 Subject: [PATCH] docs(kb): fix the example that the CLI rejects The inline example in "Can I do i18n without translation files?" put {itemCount} and a {discount && ...} conditional straight inside . gt 2.26.1 stops validate, generate and translate with " component has children that could change at runtime". The example now wraps the values in and the conditional in , and a sentence says why. Co-Authored-By: Claude Opus 5.5 --- kb/i18n-without-translation-files.mdx | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/kb/i18n-without-translation-files.mdx b/kb/i18n-without-translation-files.mdx index fd26fc963..3e9aaa354 100644 --- a/kb/i18n-without-translation-files.mdx +++ b/kb/i18n-without-translation-files.mdx @@ -47,15 +47,18 @@ ICU message syntax makes this worse. The format libraries like `i18next`, `react What if you didn't extract strings at all? ```tsx -import { T } from 'gt-react'; +import { T, Num, Branch } from 'gt-react'; function CheckoutSummary({ itemCount, discount }) { return (

Order Summary

-

You have {itemCount} items in your cart.

- {discount &&

{discount}% discount applied!

} +

You have {itemCount} items in your cart.

+ 0} + true={

{discount}% discount applied!

} + />

Total (before tax):

Tax calculated at checkout.
@@ -66,6 +69,8 @@ function CheckoutSummary({ itemCount, discount }) { The [``](/docs/react/reference/components/t) component in [`gt-react`](/docs/react/react-quickstart) marks a block of JSX for translation. The English stays in your component. When a user visits in Spanish, the content inside [``](/docs/react/reference/components/t) is replaced with its Spanish equivalent. Structure and formatting carry over. +Values that change at runtime go inside variable components such as [``](/docs/react/reference/components/num), and conditional content goes inside [``](/docs/react/reference/components/branch). The CLI stops with an error when a [``](/docs/react/reference/components/t) has children that can change at runtime. + There's no `t('checkout.summary.title')`, no `en.json`, no per-locale JSON files to keep in sync. ## Translations as build output