You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: fern/products/docs/pages/localization/overview.mdx
+70-35Lines changed: 70 additions & 35 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -24,36 +24,67 @@ You maintain your default-language pages as usual. When you run `fern generate -
24
24
[Reach out](mailto:support@buildwithfern.com) if you're interested in implementing localization for your docs.
25
25
</Note>
26
26
27
-
28
-
<Accordiontitle="Early access setup">
27
+
## Early access setup
29
28
30
29
The manual setup below works today. Once localization is generally available, most of these steps will be handled for you.
31
30
32
31
<Steps>
33
32
33
+
<Steptitle="Upgrade the Fern CLI">
34
+
35
+
Localization requires the latest CLI version.
36
+
37
+
```bash
38
+
fern upgrade
39
+
```
40
+
41
+
</Step>
42
+
43
+
<Steptitle="Declare languages in `docs.yml`">
44
+
45
+
Add a `translations` key to your `docs.yml` listing each supported language. Mark one language as the default.
46
+
47
+
```yaml docs.yml
48
+
translations:
49
+
- lang: en
50
+
default: true
51
+
- lang: ja
52
+
- lang: zh
53
+
```
54
+
55
+
Fern supports both two-letter [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) codes (e.g., `en`, `ja`, `zh`) and full [BCP 47](https://en.wikipedia.org/wiki/IETF_language_tag) locale tags (e.g., `ja-JP`, `pt-BR`, `zh-Hans-CN`).
56
+
57
+
</Step>
58
+
34
59
<Step title="Add a translations folder">
35
60
36
-
Create a `translations` folder inside your `fern` directory, with a subfolder for each language using its [BCP 47 language tag](https://en.wikipedia.org/wiki/IETF_language_tag) (e.g., `fr-FR`, `ja-JP`). Mirror your `pages/` structure inside each language folder.
61
+
Create a `translations` folder inside your `fern` directory. Each language declared in `docs.yml` needs a subfolder matching its locale code. This folder contains your translated content and navigation overrides.
@@ -62,36 +93,42 @@ Create a `translations` folder inside your `fern` directory, with a subfolder fo
62
93
63
94
</Step>
64
95
65
-
<Steptitle="Declare languages in `docs.yml`">
96
+
<Step title="Translate your navigation">
66
97
67
-
Add a `translations` key listing each supported language. The first entry is the default.
98
+
To translate navigation items, create a matching file under `fern/translations/{locale}/` for any [base config YAML](/learn/docs/configuration/overview) you have — `docs.yml`, product files, version files, etc. Include only the fields you want to translate; everything else falls back to the default language. [Example PR](https://github.com/fern-api/docs/pull/5203/files)
68
99
69
-
```yaml docs.yml {4-7}
70
-
instances:
71
-
- url: your-org.docs.buildwithfern.com
100
+
```yaml fern/translations/ja/fern/docs.yml
101
+
products:
102
+
- display-name: ホーム
103
+
path: ./products/home/home.yml
104
+
subtitle: 開発者体験を向上させる製品
72
105
73
-
translations:
74
-
- lang: en-US
75
-
- lang: fr-FR
76
-
- lang: ja-JP
77
-
```
106
+
- slug: sdks
107
+
display-name: SDK
108
+
path: ./products/sdks/sdks.yml
109
+
subtitle: 複数の言語でクライアントライブラリを生成
78
110
111
+
- slug: docs
112
+
display-name: ドキュメント
113
+
path: ./products/docs/docs.yml
114
+
subtitle: 美しいインタラクティブなドキュメントサイトを生成
115
+
```
79
116
</Step>
80
117
81
-
<Step title="Add your translated content">
118
+
<Step title="Translate page content">
82
119
83
-
Each translated `.mdx` mirrors its source page's content. Use the `sidebar-title` frontmatter field to override the sidebar entry per language:
120
+
Place translated `.mdx` files in `fern/translations/{locale}/products/` mirroring the original file structure. Use the `sidebar-title` frontmatter field to override the sidebar entry per language:
You only need to translate the files you want to localize. Anything missing from a language folder — pages, images, or other assets — falls back to the default-language version.
131
+
You only need to translate the files you want to localize. Any page missing from a language folder falls back to the default-language version automatically.
95
132
</Tip>
96
133
97
134
</Step>
@@ -102,10 +139,8 @@ Bienvenue dans la documentation.
102
139
fern generate --docs
103
140
```
104
141
105
-
When you regenerate your docs, Fern picks up the translations, renders the language switcher, and emits a sitemap entry per locale. You can also preview translations locally with `fern docs dev`.
142
+
Fern picks up the translations, renders the language switcher in the header, and emits a sitemap entry per locale. You can also preview translations locally with `fern docs dev`.
0 commit comments