Skip to content

Commit

Permalink
feat: add i18n support (#27)
Browse files Browse the repository at this point in the history
* feat: add i18n support

* fix: undo translation of some words

* chore: separate locale configs
  • Loading branch information
NozomuIkuta authored Nov 27, 2023
1 parent 556970a commit d325ce1
Show file tree
Hide file tree
Showing 45 changed files with 2,873 additions and 119 deletions.
125 changes: 125 additions & 0 deletions .vitepress/config.en.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
import type { DefaultTheme, LocaleConfig } from "vitepress";
import BLOG_SIDEBAR from "./sidebar.blog.json";

export const EN_LOCALE_CONFIG: LocaleConfig<DefaultTheme.Config> = {
root: {
label: "English",
lang: "en",
themeConfig: {
nav: [
{ text: "Guide", link: "/docs/guide/introduction" },
{ text: "Learn", link: "/docs/learn/architecture/introduction" },
{ text: "Contribute", link: "/docs/contribute/introduction" },
{ text: "Blog", link: "/blog/2022-02-10-js-tooling-research" },
{
text: "Playground",
target: "_blank",
link: "https://oxc-project.github.io/oxc/playground/",
},
],
sidebar: {
"/docs/guide/": [
{
text: "Getting Started",
items: [
{ text: "Introduction", link: "/docs/guide/introduction" },
{ text: "Benchmarks", link: "/docs/guide/benchmarks" },
],
},
{
text: "Usage",
items: [
{ text: "Linter", link: "/docs/guide/usage/linter" },
{ text: "Parser", link: "/docs/guide/usage/parser" },
{ text: "Resolver", link: "/docs/guide/usage/resolver" },
],
},
],
"/docs/learn/": [
{
text: "Architecture",
items: [
{
text: "Introduction",
link: "/docs/learn/architecture/introduction",
},
{
text: "Parser",
link: "/docs/learn/architecture/parser",
},
{
text: "Linter",
link: "/docs/learn/architecture/linter",
},
{
text: "Resolver",
link: "/docs/learn/architecture/resolver",
},
{
text: "Transformer",
link: "/docs/learn/architecture/transformer",
},
{
text: "Formatter",
link: "/docs/learn/architecture/formatter",
},
{
text: "Minifier",
link: "/docs/learn/architecture/minifier",
},
],
},
{
text: "ECMAScript",
items: [
{ text: "Spec", link: "/docs/learn/ecmascript/spec" },
{
text: "Grammar",
link: "/docs/learn/ecmascript/grammar",
},
],
},
{ text: "Performance", link: "/docs/learn/performance" },
{ text: "Ecosystem", link: "/docs/learn/ecosystem" },
{ text: "References", link: "/docs/learn/references" },
],
"/docs/contribute/": [
{
text: "Contributing Guide",
items: [
{ text: "Introduction", link: "/docs/contribute/introduction" },
{ text: "Development", link: "/docs/contribute/development" },
],
},
{
text: "Domain",
items: [
{ text: "Parser", link: "/docs/contribute/parser" },
{ text: "Linter", link: "/docs/contribute/linter" },
{ text: "Prettier", link: "/docs/contribute/prettier" },
{ text: "Resolver", link: "/docs/contribute/resolver" },
{
text: "Transformer",
link: "/docs/contribute/transformer",
},
{ text: "Formatter", link: "/docs/contribute/formatter" },
{ text: "Codegen", link: "/docs/contribute/codegen" },
{ text: "Minifier", link: "/docs/contribute/minifier" },
{ text: "VSCode", link: "/docs/contribute/vscode" },
],
},
{ text: "Performance", link: "/docs/contribute/performance" },
{ text: "Showcase", link: "/docs/contribute/showcase" },
],
"/blog/": BLOG_SIDEBAR,
},
editLink: {
pattern: "https://github.com/oxc-project/oxc/edit/main/src/:path",
text: "Edit this page",
},
footer: {
copyright: "© 2023 OXC Project",
},
},
},
};
161 changes: 161 additions & 0 deletions .vitepress/config.ja.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
import type { DefaultTheme, LocaleConfig } from "vitepress";
import BLOG_SIDEBAR from "./sidebar.blog.json";

export const JA_LOCALE_CONFIG: LocaleConfig<DefaultTheme.Config> = {
ja: {
label: "日本語",
lang: "ja",
themeConfig: {
search: {
provider: "local",
options: {
locales: {
ja: {
translations: {
button: {
buttonText: "検索する",
buttonAriaLabel: "検索する",
},
modal: {
noResultsText: "見つかりませんでした",
resetButtonTitle: "リセットする",
footer: {
selectText: "選ぶ",
navigateText: "切り替える",
closeText: "閉じる",
},
},
},
},
},
},
},
nav: [
{ text: "ガイド", link: "/ja/docs/guide/introduction" },
{ text: "学ぶ", link: "/ja/docs/learn/architecture/introduction" },
{ text: "貢献", link: "/ja/docs/contribute/introduction" },
{ text: "ブログ", link: "/ja/blog/2022-02-10-js-tooling-research" },
{
text: "プレイグラウンド",
target: "_blank",
link: "https://oxc-project.github.io/oxc/playground/",
},
],
sidebar: {
"/ja/docs/guide/": [
{
text: "はじめる",
items: [
{
text: "イントロダクション",
link: "/ja/docs/guide/introduction",
},
{ text: "ベンチマーク", link: "/ja/docs/guide/benchmarks" },
],
},
{
text: "使いかた",
items: [
{ text: "Linter", link: "/ja/docs/guide/usage/linter" },
{ text: "Parser", link: "/ja/docs/guide/usage/parser" },
{ text: "Resolver", link: "/ja/docs/guide/usage/resolver" },
],
},
],
"/ja/docs/learn/": [
{
text: "アーキテクチャ",
items: [
{
text: "イントロダクション",
link: "/ja/docs/learn/architecture/introduction",
},
{
text: "Parser",
link: "/ja/docs/learn/architecture/parser",
},
{
text: "Linter",
link: "/ja/docs/learn/architecture/linter",
},
{
text: "Resolver",
link: "/ja/docs/learn/architecture/resolver",
},
{
text: "Transformer",
link: "/ja/docs/learn/architecture/transformer",
},
{
text: "Formatter",
link: "/ja/docs/learn/architecture/formatter",
},
{
text: "Modifier",
link: "/ja/docs/learn/architecture/minifier",
},
],
},
{
text: "ECMAScript",
items: [
{ text: "仕様", link: "/ja/docs/learn/ecmascript/spec" },
{
text: "文法",
link: "/ja/docs/learn/ecmascript/grammar",
},
],
},
{ text: "パフォーマンス", link: "/ja/docs/learn/performance" },
{ text: "エコシステム", link: "/ja/docs/learn/ecosystem" },
{ text: "参考文献", link: "/ja/docs/learn/references" },
],
"/ja/docs/contribute/": [
{
text: "Contributing Guide",
items: [
{
text: "Introduction",
link: "/ja/docs/contribute/introduction",
},
{
text: "Development",
link: "/ja/docs/contribute/development",
},
],
},
{
text: "Domain",
items: [
{ text: "Parser", link: "/ja/docs/contribute/parser" },
{ text: "Linter", link: "/ja/docs/contribute/linter" },
{ text: "Prettier", link: "/ja/docs/contribute/prettier" },
{ text: "Resolver", link: "/ja/docs/contribute/resolver" },
{
text: "Transformer",
link: "/ja/docs/contribute/transformer",
},
{ text: "Formatter", link: "/ja/docs/contribute/formatter" },
{ text: "Codegen", link: "/ja/docs/contribute/codegen" },
{ text: "Minifier", link: "/ja/docs/contribute/minifier" },
{ text: "VSCode", link: "/ja/docs/contribute/vscode" },
],
},
{ text: "Performance", link: "/ja/docs/contribute/performance" },
{ text: "Showcase", link: "/ja/docs/contribute/showcase" },
],
"/ja/blog/": BLOG_SIDEBAR.map(({ text, link }) => ({
text,
link: `/ja${link}`,
})),
},
editLink: {
pattern: "https://github.com/oxc-project/oxc/edit/main/src/:path",
text: "このページを編集する",
},
footer: {
copyright: "© 2023 OXC プロジェクト",
},
},
},
};
Loading

0 comments on commit d325ce1

Please sign in to comment.