Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(i18n): support translating through locale extensions myDoc.fr.md #9700

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

slorber
Copy link
Collaborator

@slorber slorber commented Jan 4, 2024

Motivation

Translating through the i18n folder is nice for i18n SaaS integrations (Crowdin)

But it is not ideal for simpler needs based on Git, as it requires to explain the i18n folder structure convention.

To make i18n simpler to adopt, let's add support for localized file extensions to all our core content plugins

  • ./docs/myDoc.fr.md
  • ./blog/myBlog.fr.md
  • ./src/pages/myPage.fr.tsx

This kind of convention is already used by other documentation frameworks:

Note, we also want to support this for metadata files:

  • docs _category_.fr.yml
  • blog authors.fr.yml

Note, the editUrl and editLocalizedFiles options should rather work as expected too

Test Plan

Unit tests + dogfood

Test links

https://deploy-preview-9700--docusaurus-2.netlify.app/

Local:

@slorber slorber added pr: new feature This PR adds a new API or behavior. domain: i18n Related to the i18n system labels Jan 4, 2024
@facebook-github-bot facebook-github-bot added the CLA Signed Signed Facebook CLA label Jan 4, 2024
Copy link

netlify bot commented Jan 4, 2024

[V2]

Name Link
🔨 Latest commit e9b20ca
🔍 Latest deploy log https://app.netlify.com/sites/docusaurus-2/deploys/65970249b391480008b5d1a4
😎 Deploy Preview https://deploy-preview-9700--docusaurus-2.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

github-actions bot commented Jan 4, 2024

⚡️ Lighthouse report for the deploy preview of this PR

URL Performance Accessibility Best Practices SEO PWA Report
/ 🟠 65 🟢 98 🟢 100 🟢 100 🟠 89 Report
/docs/installation 🟠 69 🟢 98 🟢 100 🟢 100 🟠 89 Report
/docs/category/getting-started 🟠 75 🟢 100 🟢 100 🟢 90 🟠 89 Report
/blog 🟠 75 🟢 100 🟢 100 🟢 90 🟠 89 Report
/blog/preparing-your-site-for-docusaurus-v3 🟠 65 🟢 97 🟢 100 🟢 100 🟠 89 Report
/blog/tags/release 🟠 74 🟢 100 🟢 100 🟠 80 🟠 89 Report
/blog/tags 🟠 75 🟢 100 🟢 100 🟢 90 🟠 89 Report

Copy link

github-actions bot commented Jan 4, 2024

Size Change: +1.84 kB (0%)

Total Size: 929 kB

Filename Size Change
website/.docusaurus/globalData.json 59.5 kB +317 B (+1%)
website/build/assets/js/main.********.js 718 kB +1.52 kB (0%)
ℹ️ View Unchanged
Filename Size
website/build/assets/css/styles.********.css 114 kB
website/build/index.html 37.9 kB

compressed-size-action

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed Signed Facebook CLA domain: i18n Related to the i18n system pr: new feature This PR adds a new API or behavior.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants