Projects and localization

Contents

Next.XP maps each front-end locale to an XP project and a site within that project. The mapping controls both the Guillotine query context and the site-relative URL space.

Mapping format

Set ENONIC_MAPPINGS env var to a comma-separated list:

en:corporate/site,no:corporate-no/site,de:corporate-de/website

Each entry has the form locale:project/site, where the /site segment is optional. The first entry is the default mapping.

Value Meaning

en

Locale used in the Next.js route and phrase dictionary.

corporate

XP project queried through Guillotine.

/site

Site root path added when resolving content in XP and removed from public URLs.

Every project used for Content Studio preview must appear in the list. Otherwise /api/mappings answers 404 and Content Studio reports that the content cannot be rendered.

Mapping selection

For direct Next.js requests, the locale route selects the mapping. For Content Studio requests, the preview URL carries the locale of the editor’s active project, so preview follows that project. If neither identifies a mapping, the default entry is used.

The starter’s src/proxy.ts rewrites URLs without a locale segment to the default locale route. Public content paths remain site-relative: an XP path such as /site/about is presented as /no/about when no is the active locale.

Default locale (first one in the ENONIC_MAPPINGS list) is not included in the URL. For example, /about resolves to the content when en is default, and /en/about redirects to /about.

Static phrases

Next.XP content localization and front-end phrase localization are separate:

  • XP projects and content languages provide localized content.

  • JSON files under src/phrases/ provide static front-end text.

Use I18n in server components and LocaleContextProvider with useLocaleContext() in client components. The @phrases alias in the starter resolves locale dictionaries.

See Routing and Client API.


Contents

Contents