# 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 les fonctions serveur 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. Importez-la depuis `gt-tanstack-start/server`. ## Vue d’ensemble [#overview] ```ts import { getTranslations } from 'gt-tanstack-start/server'; 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] `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). Le `rootId` facultatif limite chaque recherche à un même chemin de dictionnaire. La fonction lève une exception lorsqu’elle est appelée 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/server'; export const loadHeading = createServerFn({ method: 'GET' }).handler( async () => { const t = await getTranslations('account'); return t('heading'); } ); ```