# General Translation React SDKs (gt-react, gt-next, gt-react-native): getTranslations URL: https://generaltranslation.com/fr/docs/react/tanstack-start/reference/functions/get-translations.mdx --- title: getTranslations description: Consultez les traductions du dictionnaire dans le runtime TanStack Start avec General Translation. Référence API pour getTranslations. --- La fonction `getTranslations` renvoie une fonction de recherche dans le dictionnaire pour la requête serveur en cours ou le navigateur. Importez-la depuis `gt-tanstack-start`. ## Vue d’ensemble [#overview] ```ts import { getTranslations } from 'gt-tanstack-start'; const t = await getTranslations('account'); const heading = t('heading'); ``` ```ts getTranslations(rootId?: string): Promise ``` ## Paramètres [#parameters] | Paramètre | Description | Type | Facultatif | Par défaut | | --------- | --------------------------------------------- | -------- | ---------- | ---------- | | `rootId` | Préfixe appliqué à chaque id du dictionnaire. | `string` | Oui | — | ## Fonctionnement [#how-it-works] Côté serveur, `getTranslations` lit le paramètre régional et le paramètre d’internationalisation créés par [`gtMiddleware`](/docs/react/tanstack-start/reference/functions/gt-middleware). Dans le navigateur, il lit le magasin de conditions initialisé par [`initializeGT`](/docs/react/reference/config#initialize). Le `rootId` facultatif limite chaque recherche à un même chemin de dictionnaire. Les appels côté serveur lèvent une exception en dehors du niveau de requête actif du middleware. La recherche d’un id de dictionnaire inconnu lève également une exception. ## Retourne [#returns] **Type** `Promise<(id: string, options?: DictionaryTranslationOptions) => string>` La fonction obtenue après résolution accepte [`DictionaryTranslationOptions`](/docs/react/reference/types/dictionary-translation-options) et expose `.obj(id)` pour les objets de dictionnaire imbriqués. ## Exemple [#example] ```ts import { createServerFn } from '@tanstack/react-start'; import { getTranslations } from 'gt-tanstack-start'; export const loadHeading = createServerFn({ method: 'GET' }).handler( async () => { const t = await getTranslations('account'); return t('heading'); } ); ```