How to convert a multi-language Framer website to Next.js

Convert a multi-language Framer site to Next.js: one route tree, locale routing in proxy.ts, translations, per-locale metadata, hreflang and a checklist.

Published
Updated
Reading time
9 min
Deframer cover: “One site, every language.” Beside it, a list of English, Deutsch, Français and Español with Deutsch selected
On this page9 sections

A multi-language Framer website converts to Next.js as one App Router tree, src/app/[locale]/, that serves every language at the URLs Framer published. Deframer generates src/proxy.ts to route prefixed and default-locale URLs, keeps translations in src/locales/, and stores each page's title, description and hreflang links per locale. What you check before launch is URL parity, hreflang, sitemaps and the production domain. Multi-locale sites get one route tree for every locale if you convert to TanStack Start, Astro or React Router too.

This post walks through each of those pieces, gives a pre-launch checklist for a multi-language migration, then covers the part that takes the most care: adding a new locale after the conversion.

The route tree: one folder for every language

A single-locale project has one page.tsx per URL directly under src/app/. A multi-locale project nests everything one level deeper:

Code
src/app/[locale]/
  layout.tsx                 root layout: <html lang>, the router in that locale
  page.tsx                   /  (default locale)  and  /en/
  kontakt/page.tsx           /kontakt  and  /en/kontakt   + metadata.json
  projects/[slug]/page.tsx   every CMS item in each locale, by its slug there
  not-found.tsx              the 404 page in the URL's locale

The folder names follow the site's paths, so a German-first site keeps kontakt rather than having it renamed. Where a locale uses its own localized path for a page, that route re-exports the shared page, so the page component exists once.

Because every locale shares a tree, a layout or component change applies to all languages at once. Only text, metadata and CMS records differ per locale.

How src/proxy.ts routes locales

Next.js 16 replaced middleware.ts with proxy.ts, and every converted project has one. On a multi-locale site it does three jobs that file-system routes can't express on their own:

  1. Maps URLs onto [locale]. It reads the URL's prefix (from a table of each locale's prefix, keyed by locale code; the default locale has none) and rewrites the request onto src/app/[locale]/…. Visitors keep seeing /ja/about; Next.js renders the [locale] route with the matching code.
  2. Keeps one URL form per page. A locale's home page answers with a trailing slash (/en/), other pages as published, and the other form redirects with a 308. That is why next.config.ts sets skipTrailingSlashRedirect: true.
  3. Serves the 404 page in the right language. An unknown URL is rewritten to the 404 page of the URL's locale with status 404, so a visitor on /ja/missing sees the Japanese 404.

The published URLs per locale are listed in src/site/pages.json. The proxy consults that list, which matters when you add pages later: a new page that isn't in pages.json for a locale will answer 404 in that locale.

Translations in src/locales/

Translations mirror the file they translate. Text for src/views/home.tsx lives under src/locales/views/home.ts plus one file per locale; text for src/components/footer.tsx lives under src/locales/components/footer.ts. To change a German heading on the home page, you open the German file for the home view and edit the string. No lookup by opaque ids, no editor round trip.

Two practical tips:

  • Search the project for the text you want to change. The match tells you which locale file holds it.
  • Keep translation edits in their own commits, so reviewers can see that a change is copy only. If you're new to working this way, maintaining a converted site with Git covers a simple branch-per-change routine.

Per-locale metadata and hreflang

Each localized route has a metadata.json beside it, evaluated at conversion time. The route reads it with the Next.js Metadata API, by locale:

tsx
// Title, description, social image and language versions of this page in each locale, evaluated at conversion time.
export async function generateMetadata({ params }: { params: Promise<{ locale: string }> }): Promise<Metadata> {
  return (metadata as Record<string, Metadata>)[(await params).locale] ?? {};
}

Each locale's entry holds the page's title, description, Open Graph and Twitter data, its canonical URL and alternates.languages: a map from locale code to that page's URL in each language, plus x-default pointing at the default locale's version. Next.js renders alternates.languages as <link rel="alternate" hreflang="…"> tags, so search engines see the same language relationships the Framer site published.

An entry looks roughly like this (illustrative; open your own metadata.json for the exact keys and URLs):

json
{
  "en": {
    "title": "Contact",
    "description": "Get in touch with the studio.",
    "alternates": {
      "canonical": "/en/kontakt",
      "languages": { "de": "/kontakt", "en": "/en/kontakt", "x-default": "/kontakt" }
    }
  }
}

If you change a title, change it here for the locale in question. If the site moves to a new domain, update metadataBase in the root layout so canonical and alternate URLs resolve against the new host. The SEO guide for moving off Framer covers that cutover in detail.

CMS content per locale

Framer CMS collections become src/cms/<collection>.json plus a typed src/cms/<collection>.ts. On a multi-locale site, a locale gets its own file, such as blog.ja-jp.json, only when its records differ from the default. Untranslated collections stay as one file.

CMS detail pages list every item in each locale by its slug there, through generateStaticParams, and read item metadata from metadata.json keyed by locale and slug:

tsx
export async function generateMetadata({ params }: { params: Promise<{ locale: string; slug: string }> }): Promise<Metadata> {
  const { locale, slug } = await params;
  return (metadata as Record<string, Record<string, Metadata>>)[locale]?.[decodeURIComponent(slug)] ?? {};
}

So adding a translated post means editing the locale's JSON record, adding its { locale, slug } pair to generateStaticParams, adding its metadata entry, and adding its path to src/site/pages.json. The CMS to JSON guide explains the record format and rich text.

Sitemaps

Per-locale sitemaps are copied into public/ exactly as the site published them: a sitemap index at public/sitemap.xml naming one sitemap per locale, such as public/sitemap_en.xml. They are static files: if you add pages or change domains, edit them (or replace them with a generated sitemap.ts that you add yourself).

A checklist for converting a multi-language Framer site

Use this before you switch DNS. Each item says what to check and how; most checks are a curl against npm run build && npm run start locally, then the same against your preview deployment.

Locale URL parity

Every URL the Framer site published, in every language, should answer 200 at the same path on the new site. The published sitemaps list them, so loop over those:

sh
grep -ho '<loc>[^<]*' public/sitemap*.xml | sed -E 's#<loc>https?://[^/]+##' | while read -r path; do
  printf '%s %s\n' "$(curl -s -o /dev/null -w '%{http_code}' "http://localhost:3000$path")" "$path"
done | grep -v '^200'

No output means every listed path answered 200. Also check the cases a sitemap doesn't cover:

  • [ ] Localized paths answer in their own locale (/en/contact if English uses its own slug, not only /en/kontakt)
  • [ ] A page published in only some languages answers 404 in the others, as it did on Framer
  • [ ] CMS detail pages answer in each locale at that locale's slug
  • [ ] An unknown path answers 404 with the 404 page in the URL's language (curl -I http://localhost:3000/ja/missing)

Default-locale URLs and redirects

The default locale has no prefix (/kontakt), and every other locale has the prefix set in Framer's localization settings (/en/kontakt). The converted proxy reproduces Framer's URL forms and nothing more:

  • [ ] Each locale's home page answers with a trailing slash (/en/), and /en redirects to it with a 308
  • [ ] Other pages answer at their published form, and the other trailing-slash form redirects with a 308
  • [ ] The default locale has no prefixed duplicate: /de/kontakt on a German-default site is not a page
  • [ ] You know whether the Framer site used Auto Locale (below), and have decided what to do about it

The generated proxy does not redirect by browser language. Visitors land on the URL they asked for and switch with the site's locale switcher, which remembers their choice in the browser. Framer has an optional Auto Locale setting that sends visitors who land on the default locale to a language matching their browser, and never redirects search engine bots (how Automatic Locale works). If your site had it switched on, the converted site behaves as if it were off.

For search, that is the safer default: Google advises against redirecting visitors automatically by their presumed language, because it can stop users and crawlers from reaching every version (managing multi-regional sites). If you want detection back, extend src/proxy.ts: read Accept-Language only on default-locale pages, skip the redirect when the visitor has chosen a language, use a temporary (307) redirect, and never redirect crawlers.

hreflang

  • [ ] Every localized page lists itself and every other language version, plus x-default
  • [ ] The links are reciprocal: if /en/kontakt points at /kontakt, /kontakt points back
  • [ ] The URLs are absolute and on your production domain

Google ignores hreflang links that aren't returned by the other page, and needs fully qualified URLs (localized versions). The route files store relative paths, and Next.js resolves them against metadataBase in the root layout, so set that to your production domain first. Then check the rendered tags:

sh
curl -s http://localhost:3000/en/kontakt | grep -io '<link[^>]*hreflang[^>]*>'

If you add a language by hand, update alternates.languages in every locale's entry, not just the new one, or the links stop being reciprocal.

Per-locale metadata and sitemaps

  • [ ] Each locale's title and description are in that language (open metadata.json beside a route and compare with the live pages)
  • [ ] <html lang> matches the URL's locale on every page
  • [ ] Canonical URLs point at the page's own language version, not at the default locale
  • [ ] public/robots.txt points at the sitemap index on the production domain
  • [ ] Each per-locale sitemap (for example public/sitemap_en.xml) lists that locale's URLs on the production domain

Search and replace the published domain in every public/sitemap*.xml file if the domain changes, then submit the sitemap index in Search Console.

Translation files

  • [ ] Copy changes are made in src/locales/, in the file that mirrors the view or component
  • [ ] Every locale's file has the same keys after an edit, so no language falls back silently
  • [ ] Translated CMS records sit in their own src/cms/<collection>.<locale>.json file with the same id values as the default

A missing translation falls back to the locale the site's settings name, so it doesn't break the build, which also means it is easy to miss. Review the page in each language after copy changes.

Adding a locale

There are two honest routes.

Option A: add it in Framer and convert again. If the site is still maintained in Framer, add the locale there, publish, and run a new conversion. Converting is free and downloading the new project uses a credit (see pricing), but the routes, translations, metadata and sitemaps all arrive consistent.

Option B: add it by hand in the project. This is a code change across several files. Mirror an existing locale exactly:

  1. Add the locale to the locales listed in src/site/routes.ts.
  2. Add its URL prefix to the prefix table in src/proxy.ts.
  3. Add its published paths to src/site/pages.json.
  4. Create a translation file for each file in src/locales/ that has one per locale.
  5. Add an entry for the locale in every route's metadata.json, and add the new language to each page's alternates.languages in the other locales too, so hreflang stays reciprocal.
  6. Add per-locale CMS files where the content differs, plus the { locale, slug } pairs in each detail route's generateStaticParams.
  7. Update or add the locale's sitemap in public/.

Then test:

sh
npm run build && npm run start
curl -I http://localhost:3000/fr/
curl -I http://localhost:3000/fr/does-not-exist

The first should answer 200, the second 404 with the French 404 page. View the page source to confirm <html lang> and the hreflang links.

Deframer is an independent tool and is not affiliated with, endorsed or sponsored by Framer. It reads only what your published site serves, in every language it publishes.

FAQ

Does Deframer keep my localized URLs?

Yes. The proxy and src/site/pages.json reproduce each locale's published paths, including localized paths, trailing-slash forms and the 404 page per locale.

Where do I edit a translation?

In src/locales/, in the file that mirrors the view or component you're changing, one file per locale. Searching the project for the current text is the quickest way to find it.

Are hreflang tags generated?

Yes. Each page's metadata.json includes alternates.languages per locale, with an x-default, and Next.js renders them as alternate links.

Do I need a separate JSON file for every locale's CMS content?

No. A per-locale file such as blog.ja-jp.json exists only when that locale's records differ from the default.

Can I add a locale without converting again?

Yes, but it touches routes, the proxy, pages.json, translations, metadata, CMS and sitemaps, so mirror an existing locale carefully. If the site is still edited in Framer, adding the locale there and converting again is often simpler.

Does the converted site redirect visitors to their browser language?

No. Each URL serves its own language, the default locale without a prefix, and visitors switch with the site's switcher. If the Framer site used its optional Auto Locale setting, that redirect isn't reproduced; you can add one to src/proxy.ts, although Google recommends language links over automatic redirects.