Skip to content

Commit d325ce1

Browse files
authored
feat: add i18n support (oxc-project#27)
* feat: add i18n support * fix: undo translation of some words * chore: separate locale configs
1 parent 556970a commit d325ce1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+2873
-119
lines changed

Diff for: .vitepress/config.en.mts

+125
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
import type { DefaultTheme, LocaleConfig } from "vitepress";
2+
import BLOG_SIDEBAR from "./sidebar.blog.json";
3+
4+
export const EN_LOCALE_CONFIG: LocaleConfig<DefaultTheme.Config> = {
5+
root: {
6+
label: "English",
7+
lang: "en",
8+
themeConfig: {
9+
nav: [
10+
{ text: "Guide", link: "/docs/guide/introduction" },
11+
{ text: "Learn", link: "/docs/learn/architecture/introduction" },
12+
{ text: "Contribute", link: "/docs/contribute/introduction" },
13+
{ text: "Blog", link: "/blog/2022-02-10-js-tooling-research" },
14+
{
15+
text: "Playground",
16+
target: "_blank",
17+
link: "https://oxc-project.github.io/oxc/playground/",
18+
},
19+
],
20+
sidebar: {
21+
"/docs/guide/": [
22+
{
23+
text: "Getting Started",
24+
items: [
25+
{ text: "Introduction", link: "/docs/guide/introduction" },
26+
{ text: "Benchmarks", link: "/docs/guide/benchmarks" },
27+
],
28+
},
29+
{
30+
text: "Usage",
31+
items: [
32+
{ text: "Linter", link: "/docs/guide/usage/linter" },
33+
{ text: "Parser", link: "/docs/guide/usage/parser" },
34+
{ text: "Resolver", link: "/docs/guide/usage/resolver" },
35+
],
36+
},
37+
],
38+
"/docs/learn/": [
39+
{
40+
text: "Architecture",
41+
items: [
42+
{
43+
text: "Introduction",
44+
link: "/docs/learn/architecture/introduction",
45+
},
46+
{
47+
text: "Parser",
48+
link: "/docs/learn/architecture/parser",
49+
},
50+
{
51+
text: "Linter",
52+
link: "/docs/learn/architecture/linter",
53+
},
54+
{
55+
text: "Resolver",
56+
link: "/docs/learn/architecture/resolver",
57+
},
58+
{
59+
text: "Transformer",
60+
link: "/docs/learn/architecture/transformer",
61+
},
62+
{
63+
text: "Formatter",
64+
link: "/docs/learn/architecture/formatter",
65+
},
66+
{
67+
text: "Minifier",
68+
link: "/docs/learn/architecture/minifier",
69+
},
70+
],
71+
},
72+
{
73+
text: "ECMAScript",
74+
items: [
75+
{ text: "Spec", link: "/docs/learn/ecmascript/spec" },
76+
{
77+
text: "Grammar",
78+
link: "/docs/learn/ecmascript/grammar",
79+
},
80+
],
81+
},
82+
{ text: "Performance", link: "/docs/learn/performance" },
83+
{ text: "Ecosystem", link: "/docs/learn/ecosystem" },
84+
{ text: "References", link: "/docs/learn/references" },
85+
],
86+
"/docs/contribute/": [
87+
{
88+
text: "Contributing Guide",
89+
items: [
90+
{ text: "Introduction", link: "/docs/contribute/introduction" },
91+
{ text: "Development", link: "/docs/contribute/development" },
92+
],
93+
},
94+
{
95+
text: "Domain",
96+
items: [
97+
{ text: "Parser", link: "/docs/contribute/parser" },
98+
{ text: "Linter", link: "/docs/contribute/linter" },
99+
{ text: "Prettier", link: "/docs/contribute/prettier" },
100+
{ text: "Resolver", link: "/docs/contribute/resolver" },
101+
{
102+
text: "Transformer",
103+
link: "/docs/contribute/transformer",
104+
},
105+
{ text: "Formatter", link: "/docs/contribute/formatter" },
106+
{ text: "Codegen", link: "/docs/contribute/codegen" },
107+
{ text: "Minifier", link: "/docs/contribute/minifier" },
108+
{ text: "VSCode", link: "/docs/contribute/vscode" },
109+
],
110+
},
111+
{ text: "Performance", link: "/docs/contribute/performance" },
112+
{ text: "Showcase", link: "/docs/contribute/showcase" },
113+
],
114+
"/blog/": BLOG_SIDEBAR,
115+
},
116+
editLink: {
117+
pattern: "https://github.com/oxc-project/oxc/edit/main/src/:path",
118+
text: "Edit this page",
119+
},
120+
footer: {
121+
copyright: "© 2023 OXC Project",
122+
},
123+
},
124+
},
125+
};

Diff for: .vitepress/config.ja.mts

+161
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,161 @@
1+
import type { DefaultTheme, LocaleConfig } from "vitepress";
2+
import BLOG_SIDEBAR from "./sidebar.blog.json";
3+
4+
export const JA_LOCALE_CONFIG: LocaleConfig<DefaultTheme.Config> = {
5+
ja: {
6+
label: "日本語",
7+
lang: "ja",
8+
themeConfig: {
9+
search: {
10+
provider: "local",
11+
options: {
12+
locales: {
13+
ja: {
14+
translations: {
15+
button: {
16+
buttonText: "検索する",
17+
buttonAriaLabel: "検索する",
18+
},
19+
modal: {
20+
noResultsText: "見つかりませんでした",
21+
resetButtonTitle: "リセットする",
22+
footer: {
23+
selectText: "選ぶ",
24+
navigateText: "切り替える",
25+
closeText: "閉じる",
26+
},
27+
},
28+
},
29+
},
30+
},
31+
},
32+
},
33+
nav: [
34+
{ text: "ガイド", link: "/ja/docs/guide/introduction" },
35+
{ text: "学ぶ", link: "/ja/docs/learn/architecture/introduction" },
36+
{ text: "貢献", link: "/ja/docs/contribute/introduction" },
37+
{ text: "ブログ", link: "/ja/blog/2022-02-10-js-tooling-research" },
38+
{
39+
text: "プレイグラウンド",
40+
target: "_blank",
41+
link: "https://oxc-project.github.io/oxc/playground/",
42+
},
43+
],
44+
sidebar: {
45+
"/ja/docs/guide/": [
46+
{
47+
text: "はじめる",
48+
items: [
49+
{
50+
text: "イントロダクション",
51+
link: "/ja/docs/guide/introduction",
52+
},
53+
{ text: "ベンチマーク", link: "/ja/docs/guide/benchmarks" },
54+
],
55+
},
56+
{
57+
text: "使いかた",
58+
items: [
59+
{ text: "Linter", link: "/ja/docs/guide/usage/linter" },
60+
{ text: "Parser", link: "/ja/docs/guide/usage/parser" },
61+
{ text: "Resolver", link: "/ja/docs/guide/usage/resolver" },
62+
],
63+
},
64+
],
65+
"/ja/docs/learn/": [
66+
{
67+
text: "アーキテクチャ",
68+
items: [
69+
{
70+
text: "イントロダクション",
71+
link: "/ja/docs/learn/architecture/introduction",
72+
},
73+
{
74+
text: "Parser",
75+
link: "/ja/docs/learn/architecture/parser",
76+
},
77+
{
78+
text: "Linter",
79+
link: "/ja/docs/learn/architecture/linter",
80+
},
81+
{
82+
text: "Resolver",
83+
link: "/ja/docs/learn/architecture/resolver",
84+
},
85+
{
86+
text: "Transformer",
87+
link: "/ja/docs/learn/architecture/transformer",
88+
},
89+
{
90+
text: "Formatter",
91+
link: "/ja/docs/learn/architecture/formatter",
92+
},
93+
{
94+
text: "Modifier",
95+
link: "/ja/docs/learn/architecture/minifier",
96+
},
97+
],
98+
},
99+
{
100+
text: "ECMAScript",
101+
items: [
102+
{ text: "仕様", link: "/ja/docs/learn/ecmascript/spec" },
103+
{
104+
text: "文法",
105+
link: "/ja/docs/learn/ecmascript/grammar",
106+
},
107+
],
108+
},
109+
{ text: "パフォーマンス", link: "/ja/docs/learn/performance" },
110+
{ text: "エコシステム", link: "/ja/docs/learn/ecosystem" },
111+
{ text: "参考文献", link: "/ja/docs/learn/references" },
112+
],
113+
"/ja/docs/contribute/": [
114+
{
115+
text: "Contributing Guide",
116+
items: [
117+
{
118+
text: "Introduction",
119+
link: "/ja/docs/contribute/introduction",
120+
},
121+
{
122+
text: "Development",
123+
link: "/ja/docs/contribute/development",
124+
},
125+
],
126+
},
127+
{
128+
text: "Domain",
129+
items: [
130+
{ text: "Parser", link: "/ja/docs/contribute/parser" },
131+
{ text: "Linter", link: "/ja/docs/contribute/linter" },
132+
{ text: "Prettier", link: "/ja/docs/contribute/prettier" },
133+
{ text: "Resolver", link: "/ja/docs/contribute/resolver" },
134+
{
135+
text: "Transformer",
136+
link: "/ja/docs/contribute/transformer",
137+
},
138+
{ text: "Formatter", link: "/ja/docs/contribute/formatter" },
139+
{ text: "Codegen", link: "/ja/docs/contribute/codegen" },
140+
{ text: "Minifier", link: "/ja/docs/contribute/minifier" },
141+
{ text: "VSCode", link: "/ja/docs/contribute/vscode" },
142+
],
143+
},
144+
{ text: "Performance", link: "/ja/docs/contribute/performance" },
145+
{ text: "Showcase", link: "/ja/docs/contribute/showcase" },
146+
],
147+
"/ja/blog/": BLOG_SIDEBAR.map(({ text, link }) => ({
148+
text,
149+
link: `/ja${link}`,
150+
})),
151+
},
152+
editLink: {
153+
pattern: "https://github.com/oxc-project/oxc/edit/main/src/:path",
154+
text: "このページを編集する",
155+
},
156+
footer: {
157+
copyright: "© 2023 OXC プロジェクト",
158+
},
159+
},
160+
},
161+
};

0 commit comments

Comments
 (0)