# gt-next: General Translation Next.js SDK: loadDictionary URL: https://generaltranslation.com/en-GB/docs/next/api/config/load-dictionary.mdx --- title: loadDictionary description: API reference for the loadDictionary() function --- ## Overview `loadDictionary` loads a translation JSON file for a given locale. This function is intended for those who want to use `gt-next` as a stand-alone i18n library. This function is primarily used to migrate existing projects with i18n to General Translation while keeping their existing translations. Follow [this guide](/docs/next/guides/migration) to set this up. If multiple translations exist, translations from dictionaries loaded by `loadDictionary` will always take precedence over the others. `loadDictionary` only supports JSON files with string translations. ## Reference ### Parameters ### Description | Type | Description | | -------- | --------------------------------------------------- | | `locale` | The locale for which translations should be loaded. | ### Returns A `Promise` that resolves to a dictionary mapping ids to translations for the given locale. *** ## Setup Generally, you will load the dictionary from the `./public/locales` directory. Define `loadDictionary` as the default export in a file named `loadDictionary.js` or `loadDictionary.ts`, either in the `src/` directory or at the root. Make sure the function returns a promise that resolves to an object containing translations for the given locale. ```jsx title="src/loadDictionary.js" export default async function loadDictionary(locale) { const translations = await import(`../public/locales/${locale}.json`); return translations.default; } ``` **Question:** What's the difference between [`loadTranslations`](/docs/next/api/config/load-translations) and [`loadDictionary`](/docs/next/api/config/load-dictionary)? * [`loadTranslations`](/docs/next/api/config/load-translations) is used to define custom loading behaviour for fetching translations for your app. This could mean getting translations from a CDN, a database, or your app's bundle. These are usually machine-generated translations, managed by the CLI tool, and not particularly user-friendly to edit. * [`loadDictionary`](/docs/next/api/config/load-dictionary) is intended for implementations of `gt-next` as a standalone library. Users bring their own translations, and no translation infrastructure is used. *** ## Notes * `loadDictionary` is used to load custom translations for your app. * Dictionaries loaded by `loadDictionary` will take precedence over translations loaded by [`loadTranslations`](/docs/next/api/config/load-translations). ## Next steps * If you want to write your own translations, see [custom translations](/docs/next/concepts/stand-alone). * See [`loadTranslations`](/docs/next/api/config/load-translations) for more information on writing a custom translation loader.