Skip to content

Commit 6f1ba1a

Browse files
feat: add internationalization support
1 parent d9eb181 commit 6f1ba1a

File tree

2 files changed

+140
-0
lines changed

2 files changed

+140
-0
lines changed

.vitepress/config.mts

+96
Original file line numberDiff line numberDiff line change
@@ -151,5 +151,101 @@ export default withMermaid({
151151
{ icon: 'youtube', link: 'https://www.youtube.com/@CodexStorage' },
152152
{ icon: 'discord', link: 'https://discord.gg/codex-storage' }
153153
]
154+
},
155+
156+
// Internationalization - https://vitepress.dev/guide/i18n
157+
locales: {
158+
root: {
159+
label: 'English',
160+
lang: 'en'
161+
},
162+
// Korean
163+
// ko: {
164+
// label: '한국어',
165+
// lang: 'ko-KP',
166+
// link: '/ko',
167+
// themeConfig: {
168+
// nav: [
169+
// { text: '백서', link: '/ko/learn/whitepaper' },
170+
// { text: 'Tokenomics Litepaper', link: '/ko/learn/tokenomics-litepaper' },
171+
// {
172+
// text: 'Codex',
173+
// items: [
174+
// { text: '소개', link: '/ko/codex/about' },
175+
// { text: '보안', link: '/ko/codex/security' },
176+
// { text: '개인정보 처리방침', link: '/ko/codex/privacy-policy' },
177+
// { text: '이용 약관', link: '/ko/codex/terms-of-use' }
178+
// ]
179+
// }
180+
// ],
181+
// editLink: {
182+
// pattern: 'https://github.com/codex-storage/codex-docs/edit/master/:path',
183+
// text: 'Edit this page on GitHub',
184+
// },
185+
// siteTitle: 'Codex • 문서',
186+
// logoLink: '/ko/learn/what-is-codex',
187+
// sidebar: [
188+
// {
189+
// text: 'Introduction',
190+
// collapsed: false,
191+
// items: [
192+
// { text: 'Codex란 무엇인가?', link: '/ko/learn/what-is-codex' },
193+
// { text: '아키텍처', link: '/ko/learn/architecture' },
194+
// { text: '백서', link: '/ko/learn/whitepaper' },
195+
// { text: 'Tokenomics Litepaper', link: '/ko/learn/tokenomics-litepaper' }
196+
// ]
197+
// },
198+
// {
199+
// text: 'Setup Codex with Installer',
200+
// collapsed: false,
201+
// items: [
202+
// { text: '면책 조항', link: '/ko/codex/installer-disclaimer' },
203+
// { text: 'Requirements', link: '/ko/learn/installer/requirements' },
204+
// { text: 'Install and Run Codex', link: '/ko/learn/installer/install-and-run' },
205+
// { text: 'Upload/Download', link: '/ko/learn/installer/upload-and-download' },
206+
// ]
207+
// },
208+
// {
209+
// text: 'Setup Codex Manually',
210+
// collapsed: false,
211+
// items: [
212+
// { text: '면책 조항', link: '/ko/codex/disclaimer' },
213+
// { text: '빠른 시작', link: '/ko/learn/quick-start' },
214+
// { text: 'Build Codex', link: '/ko/learn/build' },
215+
// { text: 'Run Codex', link: '/ko/learn/run' },
216+
// { text: '사용하기', link: '/ko/learn/using' },
217+
// { text: 'Local Two Client Test', link: '/ko/learn/local-two-client-test' },
218+
// { text: 'Local Marketplace', link: '/ko/learn/local-marketplace' },
219+
// { text: 'Download Flow', link: '/ko/learn/download-flow' },
220+
// { text: '문제 해결', link: '/ko/learn/troubleshoot' }
221+
// ]
222+
// },
223+
// {
224+
// text: 'Codex networks',
225+
// collapsed: false,
226+
// items: [
227+
// { text: '테스트넷', link: '/ko/networks/testnet' }
228+
// ]
229+
// },
230+
// {
231+
// text: 'Developers',
232+
// collapsed: false,
233+
// items: [
234+
// { text: 'API', link: '/developers/api' }
235+
// ]
236+
// },
237+
// {
238+
// text: 'Codex',
239+
// collapsed: false,
240+
// items: [
241+
// { text: '소개', link: '/ko/codex/about' },
242+
// { text: '보안', link: '/ko/codex/security' },
243+
// { text: '개인정보 처리방침', link: '/ko/codex/privacy-policy' },
244+
// { text: '이용 약관', link: '/ko/codex/terms-of-use' }
245+
// ]
246+
// }
247+
// ],
248+
// }
249+
// }
154250
}
155251
})

README.md

+44
Original file line numberDiff line numberDiff line change
@@ -76,3 +76,47 @@
7676
- `learn` - All information to learn about Codex
7777
- `networks` - Codex networks related information
7878
- `developers` - Codex development process and guides
79+
80+
81+
## Internationalization
82+
83+
We are using built-in [i18n features for Internationalization support](https://vitepress.dev/guide/i18n).
84+
85+
In order to add a new language version of the docs it is required
86+
1. Create a folder with a name of the two letter language code - `ko` for Korean, please check [List of ISO 639 language codes](https://en.wikipedia.org/wiki/List_of_ISO_639_language_codes).
87+
88+
2. Copy and translate required pages. It make sense to use English pages as a source as it is the primary language. Pages are located inside the repository sub-folders
89+
- *codex*
90+
- *developers*
91+
- *learn*
92+
- *networks*
93+
94+
After translation, we will have a new folder with all sub-folders
95+
```
96+
ko
97+
├── codex
98+
├── developers
99+
├── learn
100+
└── networks
101+
```
102+
103+
3. If you need to translate images, they are located inside a *public* folder. After translation, add a language suffix to the language specific file, for example *public/learn/architecture-`ko`.png*.
104+
105+
Then, update the docs to use a language specific image.
106+
107+
4. Add new language to the site config file - [*.vitepress/config.mts*](.vitepress/config.mts)
108+
```json
109+
// Korean
110+
ko: {
111+
label: '한국어',
112+
lang: 'ko-KP',
113+
link: '/ko',
114+
themeConfig: {}
115+
}
116+
```
117+
- `label` - Native language name from [List of ISO 639 language codes](https://en.wikipedia.org/wiki/List_of_ISO_639_language_codes)
118+
- `lang` - [\<Language code\>](https://en.wikipedia.org/wiki/List_of_ISO_639_language_codes)-[\<Country code\>](https://en.wikipedia.org/wiki/ISO_3166-1)
119+
- `link` - link to the index document located in the language specific folder
120+
- `themeConfig` - contains translation of the site elements like Nav/Side bar, etc.
121+
122+
After performed changes, we should have a documentation site in a newly added language.

0 commit comments

Comments
 (0)