# gt-react: General Translation React SDK: Strings URL: https://generaltranslation.com/en-US/docs/react/guides/strings.mdx --- title: Strings description: How to internationalize plain text strings using useGT --- {/* AUTO-GENERATED: Do not edit directly. Edit the template in content/docs-templates/ instead. */} String translation provides direct access to text translations without JSX, perfect for attributes, object properties, and plain text values. Use [`useGT`](/docs/react/api/strings/use-gt) in React components for string translation. ## Quickstart ```jsx import { useGT } from 'gt-react'; function MyComponent() { const gt = useGT(); return ( ); } ``` ## When to use string translation String translation is ideal when you need plain text rather than JSX: ### HTML attributes ```jsx const gt = useGT(); ``` ### Object properties ```jsx const gt = useGT(); const user = { name: 'John', role: 'admin', bio: gt('Experienced software developer with 5 years in React'), status: gt('Currently available for projects') }; ``` ### Configuration & constants ```jsx const gt = useGT(); const navigationItems = [ { label: gt('Home'), href: '/' }, { label: gt('Products'), href: '/products' }, { label: gt('Contact'), href: '/contact' } ]; ``` ### When to use T instead Use the [`` component](/docs/react/api/components/t) for JSX content: ```jsx // ✅ Use for JSX content

Welcome to our store!

// ✅ Use string translation for plain text ``` ## Using variables ### Basic variables Replace placeholders with dynamic values: ```jsx const gt = useGT(); const itemCount = 5; // String with placeholder const message = gt('You have {count} items in your cart', { count: itemCount }); // Result: "You have 5 items in your cart" ``` ### Multiple variables ```jsx const gt = useGT(); const order = { id: 'ORD-123', total: 99.99, date: '2024-01-15' }; const confirmation = gt( 'Order {orderId} for ${total} was placed on {date}', { orderId: order.id, total: order.total, date: order.date } ); ``` ### ICU message format For advanced formatting, use ICU syntax: ```jsx const gt = useGT(); translate('There are {count, plural, =0 {no items} =1 {one item} other {{count} items}} in the cart', { count: 10 }); ``` Learn more about ICU Message Format in the [Unicode documentation](https://unicode-org.github.io/icu/userguide/format_parse/messages/). ## Examples ### Form inputs ```jsx import { useGT } from 'gt-react'; function ContactForm() { const gt = useGT(); return (