diff --git a/kb/en-US/i18n-without-translation-files.mdx b/kb/en-US/i18n-without-translation-files.mdx index 9b0d0cde3..2bcac5d6a 100644 --- a/kb/en-US/i18n-without-translation-files.mdx +++ b/kb/en-US/i18n-without-translation-files.mdx @@ -50,15 +50,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.
@@ -69,6 +72,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