Skip to content

Commit

Permalink
chapter: internationalization add zh_CN (#34)
Browse files Browse the repository at this point in the history
* doc: add zh

* chore: lint
  • Loading branch information
artsmp0 authored Apr 18, 2024
1 parent 9b775cb commit 5e7c524
Show file tree
Hide file tree
Showing 6 changed files with 73 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/.vitepress/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,19 @@ import { defineConfig } from 'vitepress'
import { sharedConfig } from './shared'
import { ja } from './ja'
import { en } from './en'
import { zh } from './zh'

export type i18nTheme = Partial<NonNullable<UserConfig<DefaultTheme.Config>['themeConfig']>>
export type i18nTheme = Partial<
NonNullable<UserConfig<DefaultTheme.Config>['themeConfig']>
>

export default defineConfig({
...sharedConfig,
themeConfig: sharedConfig.themeConfig,
locales: {
root: { label: 'English', lang: 'en', themeConfig: { ...en } },
ja: { label: '日本語', lang: 'ja', themeConfig: { ...ja } },
zh: { label: '简体中文', lang: ' zh', themeConfig: { ...zh } },
// other languages...
},
})
14 changes: 14 additions & 0 deletions packages/.vitepress/config/zh.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import type { i18nTheme } from '.'

const nav: i18nTheme['nav'] = [
{ text: '首页', link: '/zh/' },
{ text: '指南', link: '/zh/guide/' },
]

const sidebar: i18nTheme['sidebar'] = [
{ text: '快速开始', link: '/zh/guide/' },
{ text: 'VueUse 是什么?', link: '/zh/guide/what-is-vueuse' },
{ text: '初始化', link: '/zh/guide/setup' },
]

export const zh: i18nTheme = { nav, sidebar }
22 changes: 22 additions & 0 deletions packages/zh/guide/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
## 本书的目的

本书的主要目的如下:

- 学会创建像 VueUse 一样注重"可重用性"、"可维护性"和"可扩展性"的可组合组件
- 通过实际创建各种功能的可组合组件,深入理解 Vue.js 和 TypeScript
- 阅读开源代码,学习实用的编码技术和最佳实践

## 本书的方针

- **最小化复现**: 不会完全复现 VueUse 的可组合组件,而是只实现必要的最小功能,以保持代码的可读性。
- **易于理解**: 即使是复杂的概念,也会以易于理解的方式进行解释,让读者能够顺利学习。使用清晰的解释和具体的例子,帮助读者顺利理解。
- **实用性**: 注重所学知识在实际开发中的应用价值。不仅关注理论知识,还会重点介绍实践问题解决方法和最佳实践。

## 目标读者

- 有 Vue.js 使用经验
- 有 TypeScript 使用经验

## 本书的结构

<!-- TODO: write about book structure -->
3 changes: 3 additions & 0 deletions packages/zh/guide/setup.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# 环境搭建

<!-- TODO: write how to setup -->
3 changes: 3 additions & 0 deletions packages/zh/guide/what-is-vueuse.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# 什么是 VueUse?

<!-- TODO: write what is vueuse -->
26 changes: 26 additions & 0 deletions packages/zh/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
# https://vitepress.dev/reference/default-theme-home-page
layout: home

hero:
name: "VueYous"
text: "从头开始打造自己的 VueUse"
tagline: 由 VitePress 驱动
image: /logo.png
actions:
- theme: brand
text: 快速上手
link: /zh/guide/
- theme: alt
text: VueUse 官方
link: https://vueuse.org/

# TODO: Write features
features:
- title: Feature A
details: Lorem ipsum dolor sit amet, consectetur adipiscing elit
- title: Feature B
details: Lorem ipsum dolor sit amet, consectetur adipiscing elit
- title: Feature C
details: Lorem ipsum dolor sit amet, consectetur adipiscing elit
---

0 comments on commit 5e7c524

Please sign in to comment.