facebook / facebook/docusaurus

RFC: Support i18n locale-specific content ?

Đang mở
#11,076 1 bình luận 3 reaction 0 người được giao Xem trên GitHub
feature
Ngôn ngữ chính
TypeScript
Star
66.2k
Fork
10k
Merge trung bình
1 ngày 3 giờ
Pull request đã merge (30 ngày)
52

Mô tả

### Description

Many users requested the ability to create i18n locale-specific content.

By that, I mean localized sites are mostly the same and share many pages, apart from a few exceptions like
- `/en/docs/english-only-doc`: this page only exists for the `en` locale
- `/fr/docs/french-only-doc`: this page only exists for the `fr` locale

One problem is that Docusaurus assumes that all localized sites have the same structure as the default locale. Things such as the language fallback and the i18n SEO (hreflang meta headers) and UX (ability to switch locale while staying on the same page) rely on this assumption.

---

In this RFC, I'd like to open the discussion with the community to see what can be done to make your life easier without breaking that assumption that would break features that other users like.

Recent issues discussing this topic:
- https://github.com/facebook/docusaurus/discussions/11074
- https://github.com/facebook/docusaurus/issues/11001

### API design

One possibility could be to create an API that enables users to provide front matter such as pages that do not exist in a given locale are still created but automatically redirected to another page.

This is a behavior implemented here: https://github.com/facebook/docusaurus/issues/11001#issuecomment-2745377291

The page `/fr/docs/english-only-docs` could automatically redirect to the root `/fr/` for example, or any other URL provided by the user.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.