# gt-next: General Translation Next.js SDK: Stringhe URL: https://generaltranslation.com/it/docs/next/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 delle stringhe fornisce accesso diretto alle traduzioni del testo senza JSX, ideale per attributi, proprietà degli oggetti e valori di testo semplice. Usa [`useGT`](/docs/next/api/strings/use-gt) nei componenti Next.js per la traduzione delle stringhe. ## Guida rapida ```jsx import { useGT } from 'gt-next'; function MyComponent() { const gt = useGT(); return ( ); } ``` ## Quando usare la traduzione delle stringhe La traduzione delle stringhe è ideale quando ti serve testo semplice anziché JSX: ### Attributi HTML ```jsx const gt = useGT(); ``` ### Proprietà dell'oggetto ```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 `` Usa il [componente ``](/docs/next/api/components/t) per i contenuti JSX: ```jsx // ✅ Usa per contenuto JSX

Welcome to our store!

// ✅ Usa la traduzione delle stringhe per testo normale ``` ## Uso 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 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 }); ``` Scopri di più sul formato dei messaggi ICU nella [documentazione di Unicode](https://unicode-org.github.io/icu/userguide/format_parse/messages/). ## Esempi ### Campi di input del modulo ```jsx import { useGT } from 'gt-next'; function ContactForm() { const gt = useGT(); return (