Skip to content

Commit

Permalink
chapter: Internationalization (#32)
Browse files Browse the repository at this point in the history
* configure lint

* i18n
  • Loading branch information
ubugeeei authored Apr 13, 2024
1 parent bf53b3e commit 9b775cb
Show file tree
Hide file tree
Showing 12 changed files with 135 additions and 53 deletions.
36 changes: 0 additions & 36 deletions packages/.vitepress/config.ts

This file was deleted.

14 changes: 14 additions & 0 deletions packages/.vitepress/config/en.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import type { i18nTheme } from '.'

const nav: i18nTheme['nav'] = [
{ text: 'Home', link: '/' },
{ text: 'Guide', link: '/guide/' },
]

const sidebar: i18nTheme['sidebar'] = [
{ text: 'Getting Started', link: '/guide/' },
{ text: 'What is VueUse?', link: '/guide/what-is-vueuse' },
{ text: 'Setup', link: '/guide/setup' },
]

export const en: i18nTheme = { nav, sidebar }
17 changes: 17 additions & 0 deletions packages/.vitepress/config/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import type { DefaultTheme, UserConfig } from 'vitepress'
import { defineConfig } from 'vitepress'
import { sharedConfig } from './shared'
import { ja } from './ja'
import { en } from './en'

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 } },
// other languages...
},
})
14 changes: 14 additions & 0 deletions packages/.vitepress/config/ja.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import type { i18nTheme } from '.'

const nav: i18nTheme['nav'] = [
{ text: 'Home', link: '/ja/' },
{ text: 'Guide', link: '/ja/guide/' },
]

const sidebar: i18nTheme['sidebar'] = [
{ text: 'はじめに', link: '/ja/guide/' },
{ text: 'VueUseとは', link: '/ja/guide/what-is-vueuse' },
{ text: '環境構築', link: '/ja/guide/setup' },
]

export const ja: i18nTheme = { nav, sidebar }
15 changes: 15 additions & 0 deletions packages/.vitepress/config/shared.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import type { DefaultTheme, UserConfig } from 'vitepress'

// https://vitepress.dev/reference/site-config
export const sharedConfig: UserConfig<DefaultTheme.Config> = {
title: 'VueYous',
description: 'Craft Your Own VueUse Composables From Scratch',

head: [['link', { rel: 'icon', href: '/logo.png' }]],

themeConfig: {
search: { provider: 'local' },
logo: '/logo.png',
socialLinks: [{ icon: 'github', link: 'https://github.com/pei-pay/VueYous' }],
},
} as const
30 changes: 15 additions & 15 deletions packages/guide/index.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
# はじめに
# Introduction

## 本書の目的
## Purpose of this book

以下が本書の主な目的になります。
The main objectives of this book are as follows:

- VueUse のような「再利用性」、「保守性」、「拡張性」を意識したコンポーザブルを作成できるようになる
- 様々な機能のコンポーザブルを実際に作ることで、Vue.js TypeScript の理解を深める
- オープンソースのコードを読んで、実用的なコーディングテクニックやベストプラクティスを学ぶ
- To be able to create composable functions with a focus on "reusability," "maintainability," and "extensibility" like VueUse
- To deepen the understanding of Vue.js and TypeScript by actually creating composable functions with various functionalities
- To learn practical coding techniques and best practices by reading open-source code

## 本書の方針
## Approach of this book

- **最低限で再現**: VueUse のコンポーザブルを完全再現することは目指しません。必要最低限で実装することによる読みやすさを重視します。
- **Minimal Reproduction**: We do not aim to fully replicate the composable functions of VueUse. We prioritize readability by implementing only the necessary minimum.

- **分かりやすさ**: 複雑な概念も分かりやすく解説し、読者がストレスなく学習できるよう配慮します。わかりやすい説明や具体的な例を使用し、読者がスムーズに理解できるよう努めます。
- **Clarity**: We explain complex concepts in an easy-to-understand manner and take care to ensure that readers can learn without stress. We use clear explanations and concrete examples to help readers understand smoothly.

- **実用性**: 学んだ知識が現実の開発に役立つことを重視します。理論だけでなく、実践的な問題解決のアプローチやベストプラクティスに焦点を当てます。
- **Practicality**: We emphasize that the knowledge learned is useful in real-world development. We focus not only on theory but also on practical approaches to problem-solving and best practices.

## 対象読者
## Target Audience

- Vue.js を使ったことがある
- Typescript を使ったことがある
- Those who have used Vue.js
- Those who have used TypeScript

## 本書の構成
## Structure of this book

<!-- TODO: write about book structure -->
<!-- TODO: write about book structure -->
2 changes: 1 addition & 1 deletion packages/guide/setup.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# 環境構築
# Setup

<!-- TODO: write how to setup -->
2 changes: 1 addition & 1 deletion packages/guide/what-is-vueuse.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# VueUseとは
# What is VueUse

<!-- TODO: write what is vueuse -->
26 changes: 26 additions & 0 deletions packages/ja/guide/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# はじめに

## 本書の目的

以下が本書の主な目的になります。

- VueUse のような「再利用性」、「保守性」、「拡張性」を意識したコンポーザブルを作成できるようになる
- 様々な機能のコンポーザブルを実際に作ることで、Vue.js と TypeScript の理解を深める
- オープンソースのコードを読んで、実用的なコーディングテクニックやベストプラクティスを学ぶ

## 本書の方針

- **最低限で再現**: VueUse のコンポーザブルを完全再現することは目指しません。必要最低限で実装することによる読みやすさを重視します。

- **分かりやすさ**: 複雑な概念も分かりやすく解説し、読者がストレスなく学習できるよう配慮します。わかりやすい説明や具体的な例を使用し、読者がスムーズに理解できるよう努めます。

- **実用性**: 学んだ知識が現実の開発に役立つことを重視します。理論だけでなく、実践的な問題解決のアプローチやベストプラクティスに焦点を当てます。

## 対象読者

- Vue.js を使ったことがある
- Typescript を使ったことがある

## 本書の構成

<!-- TODO: write about book structure -->
3 changes: 3 additions & 0 deletions packages/ja/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/ja/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/ja/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: 'Craft Your Own VueUse Composables From Scratch'
tagline: powered by VitePress
image: /logo.png
actions:
- theme: brand
text: 始める
link: /ja/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 9b775cb

Please sign in to comment.