DocsKey concepts
CDN
How published translations are served, cached and loaded by your app.
On this page
When you publish a project, Generic Translation writes one translation map per locale to a public endpoint. Your app fetches the map for the active locale and renders from it.
Endpoints
GET https://generic-translation-api.jacobfv123.workers.dev/cdn/{projectId}/{locale}.json
GET https://generic-translation-api.jacobfv123.workers.dev/cdn/{projectId}/manifest.json
Both are public: no Authorization header, CORS open to every origin. Anyone who knows the project id can read published translations, exactly like any other static asset of your site.
Locale map
curl -i https://generic-translation-api.jacobfv123.workers.dev/cdn/prj_abc123/es.json
HTTP/2 200
content-type: application/json
etag: "…"
cache-control: public, …
{"3f1c0a9e5b7d42c18a6e0f9d2b4c7e11":"Hola <0>{name}</0>, bienvenido de nuevo."}
The response carries an ETag and a Cache-Control header. Browsers and intermediaries revalidate with If-None-Match and receive 304 Not Modified when nothing changed.
The endpoint returns 404 with code not_found when:
- the project does not exist,
- the CDN is disabled for the project (
cdnEnabled: false), or - that locale has never been published.
Manifest
{
"projectId": "prj_abc123",
"defaultLocale": "en",
"locales": ["es", "fr", "ja"],
"version": 7,
"publishedAt": "2026-11-30T10:15:00.000Z"
}
Use the manifest to discover which locales are available, or to bust your own caches when version changes.
What gets published
Publishing takes a snapshot. Edits made in the editor after a publish are not visible on the CDN until you publish again.
If the project has requiresReview turned on, only translations with status approved are included. Unapproved strings are left out of the map, and your app renders the source text for them. See publishing.
Loading from the CDN
The libraries know the URL shape. Give the provider a project id and it fetches /{locale}.json for the active locale:
<GenericTranslationProvider projectId="prj_abc123" locale={locale} locales={["en", "es", "fr"]}>
{children}
</GenericTranslationProvider>
From any other code, fetchCdn on the core client does the same without credentials:
import { GenericTranslation } from "@generic-translation/core";
const genericTranslation = new GenericTranslation({ projectId: "prj_abc123" });
const es = await genericTranslation.fetchCdn("es"); // Record<hash, translation>
Or just fetch the URL. It is plain JSON.
No API key in the browser
The CDN exists so that browsers never need a key. Project API keys can generate translations and must stay on servers and in CI. If you need on-demand translation of dynamic content, do it in a server component or route handler, not from client code.
Self-hosted CDN paths
If you self-host, the CDN lives under your own Worker’s /cdn/ path. Set baseUrl (or GENERIC_TRANSLATION_API_URL) and the libraries build CDN URLs from it.
Something wrong or unclear on this page? Open an issue.