# react-native: Stringhe URL: https://generaltranslation.com/it/docs/react-native/guides/strings.mdx --- title: Stringhe description: Come internazionalizzare stringhe di testo semplice con useGT --- {/* GENERATO AUTOMATICAMENTE: Non modificare direttamente. Modifica invece il template in content/docs-templates/. */} La traduzione di stringhe consente di accedere direttamente alle traduzioni del testo senza JSX, ideale per attributi, proprietà di oggetti e valori di testo semplice. Usa [`useGT`](/docs/react-native/api/strings/use-gt) nei componenti React Native per tradurre le stringhe. ## Guida rapida ```jsx import { useGT } from 'gt-react-native'; function MyComponent() { const gt = useGT(); return ( ); } ``` ## Quando usare la traduzione di stringhe La traduzione di stringhe è ideale quando ti serve testo semplice anziché JSX: ### Attributi HTML ```jsx const gt = useGT(); ``` ### Proprietà degli oggetti ```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') }; ``` ### Configurazione e costanti ```jsx const gt = useGT(); const navigationItems = [ { label: gt('Home'), href: '/' }, { label: gt('Products'), href: '/products' }, { label: gt('Contact'), href: '/contact' } ]; ``` ### Quando usare invece T Usa il [componente ``](/docs/react-native/api/components/t) per il contenuto JSX: ```jsx // ✅ Usa per contenuto JSX

Welcome to our store!

// ✅ Usa la traduzione di stringhe per testo normale ``` ## Utilizzo delle variabili ### Variabili di base Sostituisci i segnaposto con valori dinamici: ```jsx const gt = useGT(); const itemCount = 5; // Stringa con segnaposto const message = gt('You have {count} items in your cart', { count: itemCount }); // Risultato: "You have 5 items in your cart" ``` ### Più variabili ```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 } ); ``` ### Formato dei messaggi ICU Per la formattazione avanzata, usa la sintassi ICU: ```jsx const gt = useGT(); translate('There are {count, plural, =0 {no items} =1 {one item} other {{count} items}} in the cart', { count: 10 }); ``` Per saperne di più sul formato dei messaggi ICU, consulta la [documentazione di Unicode](https://unicode-org.github.io/icu/userguide/format_parse/messages/). ## Esempi ### Campi del modulo ```jsx import { useGT } from 'gt-react-native'; function ContactForm() { const gt = useGT(); return (