Skip to content

feat(i18n): do not handle locales if content is missing - #1170

Merged
larbish merged 8 commits into
mainfrom
feat/missing-locales
Sep 4, 2025
Merged

larbish merged 8 commits into
mainfrom
feat/missing-locales

Conversation

@larbish

@larbish larbish commented Sep 4, 2025 •

Copy link
Copy Markdown
Collaborator

Resolves #1153

Docus now warns and skips any locale that does not exist in your content/ directory. Missing locales are not registered for the docs section.

This is especially helpful when you extend Docus and use @nuxtjs/i18n for the rest of your site, but only want the docs in a subset of languages.

Docus still detects locales from your nuxt config:

export default defineNuxtConfig({
  modules: ['@nuxtjs/i18n'],
  i18n: {
    locales: ['en', 'fr', 'ja'],
    defaultLocale: 'en'
  }
})

But only register it based on your content/ folder structure:

content/
├─ en/           # registered ✅
├─ fr/           # registered ✅ (if present)
└─ ja/           # skipped 🚫 (if missing)

If a user requests a missing docs locale, Docus redirects to the default locale.

A console warning is shown during dev/build for each skipped locale.

⚠️ Set a defaultLocale in your i18n config and ensure it exists under content/<defaultLocale>

@codesandbox

codesandbox Bot commented Sep 4, 2025

Copy link
Copy Markdown

Review or Edit in CodeSandbox

Open the branch in Web Editor • VS Code • Insiders

Open Preview

@vercel

vercel Bot commented Sep 4, 2025 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Updated (UTC)
docus Ready Ready Preview Sep 4, 2025 1:02pm

@pkg-pr-new

pkg-pr-new Bot commented Sep 4, 2025

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/create-docus@1170
npm i https://pkg.pr.new/docus@1170

commit: 9022018

@tongesy

tongesy commented Sep 4, 2025

Copy link
Copy Markdown

Amazing! Thanks for adding this. Very helpful for my use case.

This branch was successfully deployed

1 active deployment
Preview — 90220183 Deployed Sep 4, 2025 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[i18n] Being able to disable i18n mode even when the i18n module is detected

2 participants