On this page

Localized sites

Add locale-prefixed content and translated interface strings only when you maintain them.

Leave i18n unset for a single-language site. Enable it when the repository maintains translated content and someone owns the fallback behavior. Locale configuration applies to enabled collections, including docs and writing.

Configure locales

import { defineConfig } from 'tidypress'
 
export default defineConfig({
  name: 'my-project',
  i18n: {
    defaultLocale: 'en',
    locales: ['en', 'fr'],
  },
})

Routes:

/docs/getting-started
/fr/docs/getting-started
/writing
/fr/writing

The default locale stays at the root path. Non-default locales use a locale prefix.

Content

site/
└── src/content/
    ├── writing/    # dated posts (RSS, tags, archive)
    │   ├── hello.md
    │   └── fr/hello.md
    └── docs/       # docs collection — sidebar-ordered guides at /docs/…
        ├── getting-started.md
        └── fr/getting-started.md

If a non-default locale is missing a page, TidyPress falls back to the default-locale content for that route.

UI strings

i18n: {
  defaultLocale: 'en',
  locales: ['en', 'fr'],
  strings: {
    fr: {
      searchLabel: 'rechercher',
      searchPlaceholder: 'Rechercher...',
      docsTitle: 'Docs',
      writingTitle: 'Articles',
      onThisPageLabel: 'Sur cette page',
    },
  },
}

Keys:

  • docsLabel
  • writingLabel
  • moreLabel
  • searchLabel
  • searchPlaceholder
  • searchEmptyLabel
  • searchUnavailableLabel
  • searchNoResultsLabel
  • searchFilterLabel
  • searchFilterAllLabel
  • untitledLabel
  • docsTitle
  • writingTitle
  • allDocsLabel
  • allWritingLabel
  • onThisPageLabel
  • editThisPageLabel
  • copyLabel
  • copyPageLabel
  • copyMarkdownLabel
  • copyFailedLabel
  • copiedLabel
  • languageLabel (footer language switcher when i18n.locales has more than one locale)
  • chapterPreviousLabel
  • chapterNextLabel
  • manualFormBadgeLabel

The switcher renders in the footer main band (main.end). See the config reference for the footer model.

Pagefind indexes the built pages. The search UI scopes localized results to the active path when possible.