Skip to content

i18n no defaultLocale fallback handling for single-domain-deployment strategy #4723

Open
@TomPeirs

Description

🐛 Bug Report

There seems to be no fallback handling to the defaultLocale.

When I change with the localeDropdown to French (fr), my baseURL is appended with the locale. And will look like below
https://docusaurus.io/fr/docs/i18n/tutorial
However when I replace the french locale with my default locale (in my case: en) it will return a page not found.
http://localhost:3000/en/docs/intro
How can I make the defaultLocale accessible from the URL as the current 'strategy' is to strip the defaultlocale from the URL.

I think this is an important Bug because when starting to use Docusaurus V2 early we shipped some 'stable' URLs to production, and these URLs need to remain stable, meaning we have the locale always appended after the BaseURL. (also for default english).

What would be the suggestion?
(to me it seems odd I would need to use the multi domain strategy and start configuring CDNs just to get this working)

To Reproduce

  1. Configure the sites locales
    i18n: { defaultLocale: 'en', locales: ['en', 'de'], },
  2. Write your translations (.. create i18n folder, with the locale folder, etc..)
  3. Build the application npm run build using the https://docusaurus.io/docs/i18n/tutorial#single-domain-deployment single domain deployment strategy

Expected behavior

I would expect that the application is accessible with the default locale prefix in the URL.
Even better would be if you do not define the locale it all, that the application falls back to the defaultLocale if the document is available.
e.g. https://docusaurus.io/it/docs/i18n/tutorial should fall back to https://docusaurus.io/docs/i18n/tutorial in case IT (Italian) is not defined as a locale.

Actual Behavior

Currently you see a Page Not Found forward.
image

Your Environment

  • Docusaurus version used: Alpha 75
  • Operating system and version (desktop or mobile): Windows , latest Chrome

Metadata

Assignees

No one assigned

    Labels

    bugAn error in the Docusaurus core causing instability or issues with its executiondomain: i18nRelated to the i18n system

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions