# General Translation React SDKs (gt-react, gt-next, gt-react-native): Handling plurals and branches URL: https://generaltranslation.com/en-US/docs/react/guides/handling-plurals-and-branches.mdx --- title: Handling plurals and branches description: How to handle React pluralization and conditional translated content with and . related: links: - /docs/react/guides/formatting-variables - /docs/react/guides/translating-jsx - /docs/react/guides/translating-strings - /docs/react/guides/translating-with-dictionaries --- Different locales use different plural forms: English usually has `one` and `other`, while some languages need additional forms. Use [``](/docs/react/reference/components/plural) for count-based wording, and use [``](/docs/react/reference/components/branch) for other conditional content. ## Choose plurals or branches [#choose] - Use [``](/docs/react/reference/components/plural) when a number determines the wording, such as message counts or search results. - Use [``](/docs/react/reference/components/branch) when a status, plan, boolean, or other value determines the content. - Place either component inside [``](/docs/react/reference/components/t) so every variation can be translated. - Wrap dynamic values inside each variation with a [variable component](/docs/react/guides/formatting-variables), such as [``](/docs/react/reference/components/num) or [``](/docs/react/reference/components/var). Both components work the same across React, Next.js, TanStack Start, and React Native. Only the import package differs. ## Pluralize with `` [#plural] Do not build plurals by checking `count === 1` or appending an `s`; that only models English grammar. Pass the count as [`n`](/docs/react/reference/components/plural#n), then provide the forms used by your source language. [``](/docs/react/reference/components/plural) selects the correct form with the active locale's [Unicode CLDR plural rules](https://cldr.unicode.org/index/cldr-spec/plural-rules). ```tsx import { T, Plural, Num } from 'gt-react'; You have {count} message.} other={<>You have {count} messages.} /> ; ``` ```tsx import { T, Plural, Num } from 'gt-next'; You have {count} message.} other={<>You have {count} messages.} /> ; ``` ```tsx import { T, Plural, Num } from 'gt-tanstack-start'; You have {count} message.} other={<>You have {count} messages.} /> ; ``` ```tsx import { T, Plural, Num } from 'gt-react-native'; You have {count} message.} other={You have {count} messages.} /> ; ``` Provide the [`plural categories`](/docs/react/reference/components/plural#form) your source language uses—commonly `one` and `other` for English. Translators supply categories required by each target language, which may include `zero`, `two`, `few`, and `many`. If no category matches, [`children`](/docs/react/reference/components/plural#children) renders as the fallback: ```tsx One result}> {count} results ; ``` ## Branch on a value with `` [#branch] Use [``](/docs/react/reference/components/branch) when content depends on a value other than a count. Pass the value as [`branch`](/docs/react/reference/components/branch#branch), add a [prop for each expected value](/docs/react/reference/components/branch#value), and use [`children`](/docs/react/reference/components/branch#children) as the fallback. ```tsx Upgrade to unlock more.

} pro={

Thanks for going Pro!

} >

Welcome.

; ``` Each branch is translated independently, so translators can adapt its complete wording instead of working around an inline JavaScript conditional. ### Replace conditionals inside `` An inline ternary makes the children of [``](/docs/react/reference/components/t) dynamic and prevents reliable extraction. Represent the same condition with [``](/docs/react/reference/components/branch): ```tsx // ❌ Inline conditional {isActive ? 'Active' : 'Inactive'}; // ✅ Translatable branches Inactive ; ``` *Note: [``](/docs/react/reference/components/branch) ignores `data-*` attributes because non-reserved props represent branch values. Put test IDs and other data attributes on a wrapper element; the [`no-data-attrs-on-branch`](/docs/react/reference/lint-rules#no-data-attrs) lint rule flags this mistake.* ## Next steps - /docs/react/guides/formatting-variables - /docs/react/guides/translating-jsx - /docs/react/guides/translating-strings - /docs/react/guides/translating-with-dictionaries