# gt-node: General Translation Node.js SDK: Storing translations locally
URL: https://generaltranslation.com/en-US/docs/node/guides/storing-translations.mdx
Docs index: https://generaltranslation.com/llms.txt
Description: How to load General Translation translations from local files instead of the CDN in gt-node.

By default `gt-node` can load translations from the General Translation CDN. Alternatively, generate translation files, ship them with your service, and load them with a [`loadTranslations`](/docs/react/reference/functions/load-translations) callback. This removes the runtime CDN dependency at the cost of redeploying to update translations.

## Configure a local output path [#configure]

In `gt.config.json`, set the `gt` file output to a path in your project, using the `[locale]` placeholder.

```json title="gt.config.json"
{
  "defaultLocale": "en",
  "locales": ["es", "fr"],
  "files": { "gt": { "output": "translations/[locale].json" } }
}
```

## Generate the files [#generate]

Run the CLI to translate your content and write one file per locale.

```bash
npx gt translate
```

Add it to your build or deploy step so the files stay current.

## Load them at startup [#load]

Provide a `loadTranslations` callback to [`initializeGT`](/docs/node/reference/functions/initialize-gt) that reads the file for a locale.

```ts title="server.js"
import { readFile } from 'node:fs/promises';
import { initializeGT } from 'gt-node';

initializeGT({
  defaultLocale: 'en',
  locales: ['en', 'es', 'fr'],
  loadTranslations: async (locale) =>
    JSON.parse(await readFile(`./translations/${locale}.json`, 'utf8')),
});
```

With a local loader in place, translations are read from disk and no CDN request is made. To switch back to CDN delivery, remove `loadTranslations` and provide a `projectId` (see [Configure gt-node](/docs/node/guides/configuring#delivery)).

## Next steps

- /docs/node/guides/configuring
- /docs/node/guides/translating-strings
- /docs/node/guides/detecting-locale

## Sitemap

See the full [sitemap](https://generaltranslation.com/sitemap.md) for all pages.
