Skip to content

Commit ba1aca5

Browse files
drwpowphk422
andauthored
Chinese Translation by @phk422 (#1561)
* Add first i18n placeholder * docs: Separate the i8n configuration file * docs: remove `zh` from the english sidebar * docs: translate sidebar and search component * docs(chinese): translate `Introduction` * docs(chinese): translate `CLI` * docs(chinese): translate `Node.js API` * Format --------- Co-authored-by: phk422 <[email protected]>
1 parent 9c277fb commit ba1aca5

20 files changed

+969
-196
lines changed

docs/.vitepress/config.ts

+8-99
Original file line numberDiff line numberDiff line change
@@ -1,105 +1,14 @@
11
import { defineConfig } from "vitepress";
2+
import { en } from "./en";
3+
import { zh } from "./zh";
4+
import { shared } from "./shared";
25

3-
const HOSTNAME = "https://openapi-ts.pages.dev";
46

57
// https://vitepress.dev/reference/site-config
68
export default defineConfig({
7-
title: "OpenAPI TypeScript",
8-
description: "Consume OpenAPI 3.0 & 3.1 schemas in TypeScript",
9-
cleanUrls: true,
10-
srcExclude: ["**/*/CONTRIBUTRING.md", "**/*/README.md"],
11-
ignoreDeadLinks: [/CODE_OF_CONDUCT/],
12-
head: [
13-
["link", { rel: "shortcut icon", href: "/favicon.svg", type: "image/svg" }],
14-
],
15-
sitemap: {
16-
hostname: HOSTNAME,
17-
},
18-
/** @see https://vitepress.dev/reference/default-theme-config */
19-
themeConfig: {
20-
siteTitle: false,
21-
logo: "/assets/openapi-ts.svg",
22-
nav: [
23-
{
24-
text: "Versions",
25-
items: [
26-
{ text: "7.x", link: "/introduction" },
27-
{ text: "6.x", link: "/6.x/introduction" },
28-
],
29-
},
30-
],
31-
sidebar: {
32-
// 6.x docs
33-
"/6.x/": [
34-
{
35-
text: "openapi-typescript (6.x)",
36-
items: [
37-
{ text: "Introduction", link: "/6.x/introduction" },
38-
{ text: "CLI", link: "/6.x/cli" },
39-
{ text: "Node.js API", link: "/6.x/node" },
40-
{ text: "Advanced", link: "/6.x/advanced" },
41-
{ text: "About", link: "/6.x/about" },
42-
],
43-
},
44-
{
45-
text: "openapi-fetch",
46-
items: [
47-
{ text: "Getting Started", link: "/openapi-fetch/" },
48-
{
49-
text: "Middleware & Auth",
50-
link: "/openapi-fetch/middleware-auth",
51-
},
52-
{ text: "Testing", link: "/openapi-fetch/testing" },
53-
{ text: "Examples", link: "/openapi-fetch/examples" },
54-
{ text: "API", link: "/openapi-fetch/api" },
55-
{ text: "About", link: "/openapi-fetch/about" },
56-
],
57-
},
58-
],
59-
// default (7.x) docs
60-
"/": [
61-
{
62-
text: "openapi-typescript (7.x)",
63-
items: [
64-
{ text: "Introduction", link: "/introduction" },
65-
{ text: "CLI", link: "/cli" },
66-
{ text: "Node.js API", link: "/node" },
67-
{ text: "Examples", link: "/examples" },
68-
{ text: "Migrating from 6.x", link: "/migration-guide" },
69-
{ text: "Advanced", link: "/advanced" },
70-
{ text: "About", link: "/about" },
71-
],
72-
},
73-
{
74-
text: "openapi-fetch",
75-
items: [
76-
{ text: "Getting Started", link: "/openapi-fetch/" },
77-
{
78-
text: "Middleware & Auth",
79-
link: "/openapi-fetch/middleware-auth",
80-
},
81-
{ text: "Testing", link: "/openapi-fetch/testing" },
82-
{ text: "Examples", link: "/openapi-fetch/examples" },
83-
{ text: "API", link: "/openapi-fetch/api" },
84-
{ text: "About", link: "/openapi-fetch/about" },
85-
],
86-
},
87-
],
88-
},
89-
search: {
90-
provider: "algolia",
91-
options: {
92-
appId: "NA92XVKBVS",
93-
apiKey: "4f3ce9ca7edc3b83c209e6656ab29eb8",
94-
indexName: "openapi-ts",
95-
},
96-
},
97-
socialLinks: [
98-
{ icon: "github", link: "https://github.com/drwpow/openapi-typescript" },
99-
],
100-
footer: {
101-
message:
102-
'Released under the <a href="https://github.com/drwpow/openapi-typescript/blob/main/packages/openapi-typescript/LICENSE">MIT License</a>.',
103-
},
104-
},
9+
...shared,
10+
locales: {
11+
root: { label: 'English', ...en },
12+
zh: { label: '简体中文', ...zh }
13+
}
10514
});

docs/.vitepress/en.ts

+89
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
import { defineConfig } from "vitepress";
2+
3+
export const en = defineConfig({
4+
description: "Consume OpenAPI 3.0 & 3.1 schemas in TypeScript",
5+
themeConfig: {
6+
nav: [
7+
{
8+
text: "Version",
9+
items: [
10+
{ text: "7.x", link: "/introduction" },
11+
{ text: "6.x", link: "/6.x/introduction" },
12+
],
13+
},
14+
],
15+
sidebar: {
16+
// 6.x docs
17+
"/6.x/": [
18+
{
19+
text: "openapi-typescript (6.x)",
20+
items: [
21+
{ text: "Introduction", link: "/6.x/introduction" },
22+
{ text: "CLI", link: "/6.x/cli" },
23+
{ text: "Node.js API", link: "/6.x/node" },
24+
{ text: "Advanced", link: "/6.x/advanced" },
25+
{ text: "About", link: "/6.x/about" },
26+
],
27+
},
28+
{
29+
text: "openapi-fetch",
30+
items: [
31+
{ text: "Getting Started", link: "/openapi-fetch/" },
32+
{
33+
text: "Middleware & Auth",
34+
link: "/openapi-fetch/middleware-auth",
35+
},
36+
{ text: "Testing", link: "/openapi-fetch/testing" },
37+
{ text: "Examples", link: "/openapi-fetch/examples" },
38+
{ text: "API", link: "/openapi-fetch/api" },
39+
{ text: "About", link: "/openapi-fetch/about" },
40+
],
41+
},
42+
],
43+
// default (7.x) docs
44+
"/": [
45+
{
46+
text: "openapi-typescript (7.x)",
47+
items: [
48+
{ text: "Introduction", link: "/introduction" },
49+
{ text: "CLI", link: "/cli" },
50+
{ text: "Node.js API", link: "/node" },
51+
{ text: "Examples", link: "/examples" },
52+
{ text: "Migrating from 6.x", link: "/migration-guide" },
53+
{ text: "Advanced", link: "/advanced" },
54+
{ text: "About", link: "/about" },
55+
],
56+
},
57+
{
58+
text: "openapi-fetch",
59+
items: [
60+
{ text: "Getting Started", link: "/openapi-fetch/" },
61+
{
62+
text: "Middleware & Auth",
63+
link: "/openapi-fetch/middleware-auth",
64+
},
65+
{ text: "Testing", link: "/openapi-fetch/testing" },
66+
{ text: "Examples", link: "/openapi-fetch/examples" },
67+
{ text: "API", link: "/openapi-fetch/api" },
68+
{ text: "About", link: "/openapi-fetch/about" },
69+
],
70+
},
71+
],
72+
},
73+
search: {
74+
provider: "algolia",
75+
options: {
76+
appId: "NA92XVKBVS",
77+
apiKey: "4f3ce9ca7edc3b83c209e6656ab29eb8",
78+
indexName: "openapi-ts",
79+
},
80+
},
81+
socialLinks: [
82+
{ icon: "github", link: "https://github.com/drwpow/openapi-typescript" },
83+
],
84+
footer: {
85+
message:
86+
'Released under the <a href="https://github.com/drwpow/openapi-typescript/blob/main/packages/openapi-typescript/LICENSE">MIT License</a>.',
87+
},
88+
},
89+
});

docs/.vitepress/shared.ts

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import { defineConfig } from 'vitepress'
2+
import { zhSearch } from './zh'
3+
4+
const HOSTNAME = "https://openapi-ts.pages.dev";
5+
6+
export const shared = defineConfig({
7+
title: "OpenAPI TypeScript",
8+
cleanUrls: true,
9+
srcExclude: ["**/*/CONTRIBUTRING.md", "**/*/README.md"],
10+
ignoreDeadLinks: [/CODE_OF_CONDUCT/],
11+
head: [
12+
["link", { rel: "shortcut icon", href: "/favicon.svg", type: "image/svg" }],
13+
],
14+
sitemap: {
15+
hostname: HOSTNAME,
16+
},
17+
themeConfig: {
18+
siteTitle: false,
19+
logo: "/assets/openapi-ts.svg",
20+
search: {
21+
provider: "algolia",
22+
options: {
23+
appId: "NA92XVKBVS",
24+
apiKey: "4f3ce9ca7edc3b83c209e6656ab29eb8",
25+
indexName: "openapi-ts",
26+
locales: { ...zhSearch }
27+
},
28+
},
29+
socialLinks: [
30+
{ icon: "github", link: "https://github.com/drwpow/openapi-typescript" },
31+
],
32+
},
33+
})

docs/.vitepress/zh.ts

+104
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
import { defineConfig, type DefaultTheme } from "vitepress";
2+
3+
export const zh = defineConfig({
4+
lang: "zh-Hans",
5+
description: "在 TypeScript 中使用 OpenAPI 3.0 和 3.1 的模式。",
6+
themeConfig: {
7+
nav: [
8+
{
9+
text: "版本",
10+
items: [
11+
{ text: "7.x", link: "/zh/introduction" },
12+
{ text: "6.x", link: "/6.x/introduction" },
13+
],
14+
},
15+
],
16+
sidebar: {
17+
"/zh/": [
18+
{
19+
text: "openapi-typescript",
20+
items: [
21+
{ text: "介绍", link: "/zh/introduction" },
22+
{ text: "命令行(CLI)", link: "/zh/cli" },
23+
{ text: "Node.js API", link: "/zh/node" },
24+
{ text: "示例", link: "/zh/examples" },
25+
{ text: "高级功能", link: "/zh/advanced" },
26+
{ text: "关于", link: "/zh/about" },
27+
],
28+
},
29+
{
30+
text: "openapi-fetch",
31+
items: [
32+
{ text: "快速上手", link: "/zh/openapi-fetch/" },
33+
{
34+
text: "中间件与认证方式",
35+
link: "/zh/openapi-fetch/middleware-auth",
36+
},
37+
{ text: "测试", link: "/zh/openapi-fetch/testing" },
38+
{ text: "示例", link: "/zh/openapi-fetch/examples" },
39+
{ text: "API", link: "/zh/openapi-fetch/api" },
40+
{ text: "关于", link: "/zh/openapi-fetch/about" },
41+
],
42+
},
43+
],
44+
},
45+
46+
docFooter: {
47+
prev: "上一页",
48+
next: "下一页",
49+
},
50+
51+
outline: {
52+
label: "页面导航",
53+
},
54+
55+
footer: {
56+
message:
57+
'基于 <a href="https://github.com/drwpow/openapi-typescript/blob/main/packages/openapi-typescript/LICENSE">MIT</a> 许可发布',
58+
},
59+
},
60+
});
61+
62+
export const zhSearch: DefaultTheme.AlgoliaSearchOptions["locales"] = {
63+
zh: {
64+
placeholder: "搜索文档",
65+
translations: {
66+
button: {
67+
buttonText: "搜索文档",
68+
buttonAriaLabel: "搜索文档",
69+
},
70+
modal: {
71+
searchBox: {
72+
resetButtonTitle: "清除查询条件",
73+
resetButtonAriaLabel: "清除查询条件",
74+
cancelButtonText: "取消",
75+
cancelButtonAriaLabel: "取消",
76+
},
77+
startScreen: {
78+
recentSearchesTitle: "搜索历史",
79+
noRecentSearchesText: "没有搜索历史",
80+
saveRecentSearchButtonTitle: "保存至搜索历史",
81+
removeRecentSearchButtonTitle: "从搜索历史中移除",
82+
favoriteSearchesTitle: "收藏",
83+
removeFavoriteSearchButtonTitle: "从收藏中移除",
84+
},
85+
errorScreen: {
86+
titleText: "无法获取结果",
87+
helpText: "你可能需要检查你的网络连接",
88+
},
89+
footer: {
90+
selectText: "选择",
91+
navigateText: "切换",
92+
closeText: "关闭",
93+
searchByText: "搜索提供者",
94+
},
95+
noResultsScreen: {
96+
noResultsText: "无法找到相关结果",
97+
suggestedQueryText: "你可以尝试查询",
98+
reportMissingResultsText: "你认为该查询应该有结果?",
99+
reportMissingResultsLinkText: "点击反馈",
100+
},
101+
},
102+
},
103+
},
104+
};

docs/data/contributors.json

+1-1
Large diffs are not rendered by default.

docs/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@
1010
"update-contributors": "node scripts/update-contributors.js"
1111
},
1212
"devDependencies": {
13-
"vitepress": "1.0.0-rc.42"
13+
"vitepress": "1.0.0-rc.44"
1414
}
1515
}

docs/zh/about.md

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
---
2+
title: About openapi-typescript
3+
description: Additional info about this project
4+
---
5+
6+
<script setup>
7+
import { VPTeamMembers } from 'vitepress/theme';
8+
import contributors from '../data/contributors.json';
9+
</script>
10+
11+
# About openapi-typescript
12+
13+
::: warning
14+
15+
This article is a stub. Please help [expand it](https://github.com/drwpow/openapi-typescript/tree/main/docs/zh/)!
16+
17+
:::
18+
19+
## Used by
20+
21+
- [**Bigcommerce**](https://github.com/bigcommerce/bigcommerce-api-node): Node SDK for the BigCommerce API
22+
- [**Budibase**](https://github.com/Budibase/budibase): low code platform for creating internal tools, workflows, and admin panels
23+
- [**Fedora `fmn`**](https://github.com/fedora-infra/fmn): tools and APIs for Fedora’s messaging infra
24+
- [**Fingerprint**](https://github.com/fingerprintjs/fingerprintjs-pro-server-api-node-sdk): device fingerprinting for high-scale applications
25+
- [**Google Firebase CLI**](https://github.com/firebase/firebase-tools): Official CLI for Google’s Firebase platform
26+
- [**GitHub Octokit**](https://github.com/octokit): Official SDK for the GitHub API
27+
- [**Lotus**](https://github.com/uselotus/lotus): open source pricing & packaging infra
28+
- [**Jitsu**](https://github.com/jitsucom/jitsu): modern, open source data ingestion / data pipelines
29+
- [**Medusa**](https://github.com/medusajs/medusa): building blocks for digital commerce
30+
- [**Netlify**](https://netlify.com): the modern development platform
31+
- [**Nuxt**](https://github.com/unjs/nitro): The Intuitive Vue framework
32+
- [**Relevance AI**](https://github.com/RelevanceAI/relevance-js-sdk): build and deploy AI chains
33+
- [**Revolt**](https://github.com/revoltchat/api): open source user-first chat platform
34+
- [**Spacebar**](https://github.com/spacebarchat): a free, open source, self-hostable Discord-compatible chat/voice/video platform
35+
- [**Supabase**](https://github.com/supabase/supabase): The open source Firebase alternative.
36+
- [**Twitter API**](https://github.com/twitterdev/twitter-api-typescript-sdk): Official SDK for the Twitter API
37+
38+
## Project goals

0 commit comments

Comments
 (0)