# gt-react: General Translation React SDK: DictionaryTranslationOptions URL: https://generaltranslation.com/en-GB/docs/react/api/types/dictionary-translation-options.mdx --- title: DictionaryTranslationOptions description: API reference for the DictionaryTranslationOptions type --- {/* AUTO-GENERATED: Do not edit directly. Edit the template in content/docs-templates/ instead. */} ## Overview The `DictionaryTranslationOptions` type is used to pass variables to dictionary entries and control how they are rendered. It is used with [`useTranslations`](/docs/react/api/dictionary/use-translations) to pass variables to dictionary entries. **Build-time Translation:** `useTranslations` translations occur at build time; however, variables are never translated. Instead, they are inserted into the translation with formatting. Make sure to follow the [deployment guide here](/docs/react/tutorials/quickdeploy). ## Reference ### Parameters ', optional: true, default: 'undefined', }, }} /> ### Description | Prop | Description | | ----------- | --------------------------------------------------------------------------------- | | `variables` | An object whose keys identify where each value is mapped in the dictionary entry. | *** ## Examples ### Passing variables To pass a variable to the dictionary entry, we need to do two things: (1) add a variable to the entry and (2) reference that variable in the [`d`](/docs/react/api/dictionary/use-translations) invocation. First, we add a variable to the dictionary entry using the following syntax: `{username}`. `username` is the name of the variable. ```jsx title="dictionary.ts" // [!code word:username] const dictionary = { greeting: { hello: 'Hello, {username}!', }, }; export default dictionary; ``` Next, we reference the variable: ```jsx title="Component.tsx" // [!code word:username] import { useTranslations } from 'gt-react'; const Component = () => { const t = useTranslations(); return
{t('greeting.hello', { username : 'Brian123' })}
; }; ``` ### Using ICU message format `gt-react` supports ICU message format, which also lets you format your variables. ```jsx title="dictionary.ts" // [!code word:account-balance] const dictionary = { account: { balance: 'Your account balance: {dollars, number, ::currency/GBP}!', }, }; export default dictionary; ``` Next, we reference the variable: ```jsx title="Component.tsx" // [!code word:account-balance] import { useTranslations } from 'gt-react'; const Component = () => { const t = useTranslations(); return
{ t( 'account.balance', { "dollars" : 1000000, } ) }
; }; ``` *** ## Notes * The `variables` object passes values to a dictionary entry. * The `variablesOptions` object defines the behaviour of the variables. ## Next steps * See [dictionaries](/docs/react/guides/dictionaries) for more information on dictionaries and common practices. * See [`useTranslations`](/docs/react/api/dictionary/use-translations) for more information on the dictionaries interface. * See [`ICU message format`](https://unicode-org.github.io/icu/userguide/format_parse/messages/) for more information on formatting options.