feat(i18n): support translating through locale extensions `myDoc.fr.md`
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:
- https://ultrabug.github.io/mkdocs-static-i18n/getting-started/quick-start/
- https://nextra.site/docs/guide/i18n#add-locale-to-filenames
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:
- http://localhost:3000/fr/tests/pages/i18n
- http://localhost:3000/fr/tests/blog/i18n
- http://localhost:3000/fr/tests/docs/i18n
[V2]
| Name | Link |
|---|---|
| Latest commit | e9b20ca990ccf00a6c38336781a4f68b2dfa1748 |
| 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...Use your smartphone camera to open QR code link. |
To edit notification comments on pull requests, go to your Netlify site configuration.
âĄī¸ 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 |
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 |