Skip to content

Commit e0d739a

Browse files
authored
docs(ja): add Japanese translations (#4969)
1 parent ac5ddd3 commit e0d739a

37 files changed

+7185
-1
lines changed

docs/.vitepress/config.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ export default defineConfig({
5252
return 'Скопировать код'
5353
case 'zh':
5454
return '复制代码'
55+
case 'ja':
56+
return 'コードをコピー'
5557
default:
5658
return 'Copy code'
5759
}
@@ -130,7 +132,8 @@ export default defineConfig({
130132
ru: { label: 'Русский', lang: 'ru-RU', dir: 'ltr' },
131133
es: { label: 'Español', lang: 'es', dir: 'ltr' },
132134
ko: { label: '한국어', lang: 'ko-KR', dir: 'ltr' },
133-
fa: { label: 'فارسی', lang: 'fa-IR', dir: 'rtl' }
135+
fa: { label: 'فارسی', lang: 'fa-IR', dir: 'rtl' },
136+
ja: { label: '日本語', lang: 'ja', dir: 'ltr' }
134137
},
135138

136139
vite: {

docs/ja/config.ts

Lines changed: 225 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,225 @@
1+
import { createRequire } from 'module'
2+
import { defineAdditionalConfig, type DefaultTheme } from 'vitepress'
3+
4+
const require = createRequire(import.meta.url)
5+
const pkg = require('vitepress/package.json')
6+
7+
export default defineAdditionalConfig({
8+
description: 'Vite と Vue による静的サイトジェネレーター',
9+
10+
themeConfig: {
11+
nav: nav(),
12+
13+
search: { options: searchOptions() },
14+
15+
sidebar: {
16+
'/ja/guide/': { base: '/ja/guide/', items: sidebarGuide() },
17+
'/ja/reference/': { base: '/ja/reference/', items: sidebarReference() }
18+
},
19+
20+
editLink: {
21+
pattern: 'https://github.com/vuejs/vitepress/edit/main/docs/:path',
22+
text: 'GitHub でこのページを編集'
23+
},
24+
25+
footer: {
26+
message: 'MIT ライセンスの下で公開されています。',
27+
copyright: 'Copyright © 2019-present Evan You'
28+
}
29+
}
30+
})
31+
32+
function nav(): DefaultTheme.NavItem[] {
33+
return [
34+
{
35+
text: 'ガイド',
36+
link: '/ja/guide/what-is-vitepress',
37+
activeMatch: '/guide/'
38+
},
39+
{
40+
text: 'リファレンス',
41+
link: '/ja/reference/site-config',
42+
activeMatch: '/reference/'
43+
},
44+
{
45+
text: pkg.version,
46+
items: [
47+
{
48+
text: '1.6.4',
49+
link: 'https://vuejs.github.io/vitepress/v1/'
50+
},
51+
{
52+
text: '更新履歴',
53+
link: 'https://github.com/vuejs/vitepress/blob/main/CHANGELOG.md'
54+
},
55+
{
56+
text: 'コントリビュート方法',
57+
link: 'https://github.com/vuejs/vitepress/blob/main/.github/contributing.md'
58+
}
59+
]
60+
}
61+
]
62+
}
63+
64+
function sidebarGuide(): DefaultTheme.SidebarItem[] {
65+
return [
66+
{
67+
text: '導入',
68+
collapsed: false,
69+
items: [
70+
{ text: 'VitePress とは?', link: 'what-is-vitepress' },
71+
{ text: 'はじめに', link: 'getting-started' },
72+
{ text: 'ルーティング', link: 'routing' },
73+
{ text: 'デプロイ', link: 'deploy' }
74+
]
75+
},
76+
{
77+
text: '執筆',
78+
collapsed: false,
79+
items: [
80+
{ text: 'Markdown 拡張', link: 'markdown' },
81+
{ text: 'アセットの取り扱い', link: 'asset-handling' },
82+
{ text: 'フロントマター', link: 'frontmatter' },
83+
{ text: 'Markdown で Vue を使う', link: 'using-vue' },
84+
{ text: '多言語対応', link: 'i18n' }
85+
]
86+
},
87+
{
88+
text: 'カスタマイズ',
89+
collapsed: false,
90+
items: [
91+
{ text: 'カスタムテーマを使う', link: 'custom-theme' },
92+
{
93+
text: 'デフォルトテーマの拡張',
94+
link: 'extending-default-theme'
95+
},
96+
{ text: 'ビルド時のデータ読み込み', link: 'data-loading' },
97+
{ text: 'SSR 互換性', link: 'ssr-compat' },
98+
{ text: 'CMS との接続', link: 'cms' }
99+
]
100+
},
101+
{
102+
text: '実験的機能',
103+
collapsed: false,
104+
items: [
105+
{ text: 'MPA モード', link: 'mpa-mode' },
106+
{ text: 'サイトマップ生成', link: 'sitemap-generation' }
107+
]
108+
},
109+
{
110+
text: '設定 & API リファレンス',
111+
base: '/ja/reference/',
112+
link: 'site-config'
113+
}
114+
]
115+
}
116+
117+
function sidebarReference(): DefaultTheme.SidebarItem[] {
118+
return [
119+
{
120+
text: 'リファレンス',
121+
items: [
122+
{ text: 'サイト設定', link: 'site-config' },
123+
{ text: 'Frontmatter 設定', link: 'frontmatter-config' },
124+
{ text: 'ランタイム API', link: 'runtime-api' },
125+
{ text: 'CLI', link: 'cli' },
126+
{
127+
text: 'デフォルトテーマ',
128+
base: '/ja/reference/default-theme-',
129+
items: [
130+
{ text: '概要', link: 'config' },
131+
{ text: 'ナビゲーション', link: 'nav' },
132+
{ text: 'サイドバー', link: 'sidebar' },
133+
{ text: 'ホームページ', link: 'home-page' },
134+
{ text: 'フッター', link: 'footer' },
135+
{ text: 'レイアウト', link: 'layout' },
136+
{ text: 'バッジ', link: 'badge' },
137+
{ text: 'チームページ', link: 'team-page' },
138+
{ text: '前 / 次 リンク', link: 'prev-next-links' },
139+
{ text: '編集リンク', link: 'edit-link' },
140+
{ text: '最終更新日時', link: 'last-updated' },
141+
{ text: '検索', link: 'search' },
142+
{ text: 'Carbon 広告', link: 'carbon-ads' }
143+
]
144+
}
145+
]
146+
}
147+
]
148+
}
149+
150+
function searchOptions(): Partial<DefaultTheme.AlgoliaSearchOptions> {
151+
return {
152+
placeholder: 'ドキュメントを検索',
153+
translations: {
154+
button: {
155+
buttonText: '検索',
156+
buttonAriaLabel: '検索'
157+
},
158+
modal: {
159+
searchBox: {
160+
clearButtonTitle: '検索をクリア',
161+
clearButtonAriaLabel: '検索をクリア',
162+
closeButtonText: '閉じる',
163+
closeButtonAriaLabel: '閉じる',
164+
placeholderText: 'ドキュメントを検索',
165+
placeholderTextAskAi: 'AI に質問: ',
166+
placeholderTextAskAiStreaming: '回答を作成中...',
167+
searchInputLabel: '検索',
168+
backToKeywordSearchButtonText: 'キーワード検索に戻る',
169+
backToKeywordSearchButtonAriaLabel: 'キーワード検索に戻る'
170+
},
171+
startScreen: {
172+
recentSearchesTitle: '検索履歴',
173+
noRecentSearchesText: '最近の検索はありません',
174+
saveRecentSearchButtonTitle: '検索履歴に保存',
175+
removeRecentSearchButtonTitle: '検索履歴から削除',
176+
favoriteSearchesTitle: 'お気に入り',
177+
removeFavoriteSearchButtonTitle: 'お気に入りから削除',
178+
recentConversationsTitle: '最近の会話',
179+
removeRecentConversationButtonTitle: '会話履歴から削除'
180+
},
181+
errorScreen: {
182+
titleText: '結果を取得できません',
183+
helpText: 'ネットワーク接続を確認してください'
184+
},
185+
noResultsScreen: {
186+
noResultsText: '結果が見つかりません',
187+
suggestedQueryText: '別の検索語を試してください',
188+
reportMissingResultsText: '結果があるはずだと思いますか?',
189+
reportMissingResultsLinkText: 'フィードバックを送る'
190+
},
191+
resultsScreen: {
192+
askAiPlaceholder: 'AI に質問: '
193+
},
194+
askAiScreen: {
195+
disclaimerText:
196+
'AI が生成した回答には誤りが含まれる可能性があります。必ずご確認ください。',
197+
relatedSourcesText: '関連ソース',
198+
thinkingText: '考え中...',
199+
copyButtonText: 'コピー',
200+
copyButtonCopiedText: 'コピーしました!',
201+
copyButtonTitle: 'コピー',
202+
likeButtonTitle: 'いいね',
203+
dislikeButtonTitle: 'よくない',
204+
thanksForFeedbackText: 'フィードバックありがとうございます!',
205+
preToolCallText: '検索中...',
206+
duringToolCallText: '検索中 ',
207+
afterToolCallText: '検索完了',
208+
aggregatedToolCallText: '検索完了'
209+
},
210+
footer: {
211+
selectText: '選択',
212+
submitQuestionText: '質問を送信',
213+
selectKeyAriaLabel: 'Enter キー',
214+
navigateText: '移動',
215+
navigateUpKeyAriaLabel: '上矢印キー',
216+
navigateDownKeyAriaLabel: '下矢印キー',
217+
closeText: '閉じる',
218+
backToSearchText: '検索に戻る',
219+
closeKeyAriaLabel: 'Esc キー',
220+
poweredByText: '提供: '
221+
}
222+
}
223+
}
224+
}
225+
}

docs/ja/guide/asset-handling.md

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# アセットの取り扱い {#asset-handling}
2+
3+
## 静的アセットの参照 {#referencing-static-assets}
4+
5+
すべての Markdown ファイルは Vue コンポーネントにコンパイルされ、[Vite](https://vitejs.dev/guide/assets.html) によって処理されます。Markdown 内では、相対 URL を使ってアセットを参照することが **推奨されます**
6+
7+
```md
8+
![画像](./image.png)
9+
```
10+
11+
Markdown ファイル内、テーマの `*.vue` コンポーネント内、スタイルや通常の `.css` ファイル内でも、アセットはプロジェクトルートを基準とした絶対パス、またはファイルシステムを基準とした相対パスで参照できます。後者は Vite、Vue CLI、あるいは webpack の `file-loader` を使ったことがある場合に慣れ親しんだ挙動です。
12+
13+
一般的な画像、メディア、フォントファイルタイプは自動的にアセットとして検出され、含まれます。
14+
15+
::: tip リンクされたファイルはアセットとして扱われません
16+
Markdown ファイル内のリンクで参照された PDF やその他のドキュメントは、自動的にアセットとして扱われません。これらのリンクファイルにアクセスできるようにするには、手動でプロジェクトの [`public`](#the-public-directory) ディレクトリに配置する必要があります。
17+
:::
18+
19+
絶対パスを含むすべての参照されたアセットは、プロダクションビルド時にハッシュ化されたファイル名で出力ディレクトリにコピーされます。参照されないアセットはコピーされません。4kb 未満の画像アセットは base64 としてインライン化されます(これは [`vite`](../reference/site-config#vite) 設定オプションで変更可能です)。
20+
21+
すべての **静的な** パス参照(絶対パスを含む)は、作業ディレクトリの構造を基準にする必要があります。
22+
23+
## Public ディレクトリ {#the-public-directory}
24+
25+
Markdown やテーマコンポーネントで直接参照されない静的アセットを提供する必要がある場合や、特定のファイルをオリジナルのファイル名のまま提供したい場合があります。
26+
例えば `robots.txt`、favicon、PWA 用アイコンなどです。
27+
28+
これらのファイルは [ソースディレクトリ](./routing#source-directory) 配下の `public` ディレクトリに配置できます。たとえばプロジェクトルートが `./docs` で、デフォルトのソースディレクトリを使用している場合、`public` ディレクトリは `./docs/public` になります。
29+
30+
`public` に配置されたアセットは、出力ディレクトリのルートにそのままコピーされます。
31+
32+
なお、`public` 内のファイルはルート絶対パスで参照する必要があります。例えば `public/icon.png` は常に `/icon.png` として参照しなければなりません。
33+
34+
## ベース URL {#base-url}
35+
36+
サイトをルート以外の URL にデプロイする場合、`.vitepress/config.js``base` オプションを設定する必要があります。
37+
例えば `https://foo.github.io/bar/` にデプロイする場合、`base``'/bar/'` と設定します(必ずスラッシュで開始・終了する必要があります)。
38+
39+
すべての静的アセットパスは `base` 設定値に応じて自動的に調整されます。
40+
例えば Markdown 内で `public` 配下のアセットを絶対参照した場合:
41+
42+
```md
43+
![画像](/image-inside-public.png)
44+
```
45+
46+
この場合は `base` の設定値を変更しても、参照を修正する必要はありません。
47+
48+
ただし、テーマコンポーネントで動的にアセットをリンクする場合(例:テーマ設定値に基づいた画像の `src`)は注意が必要です。
49+
50+
```vue
51+
<img :src="theme.logoPath" />
52+
```
53+
54+
この場合は、VitePress が提供する [`withBase` ヘルパー](../reference/runtime-api#withbase) でパスをラップすることを推奨します。
55+
56+
```vue
57+
<script setup>
58+
import { withBase, useData } from 'vitepress'
59+
60+
const { theme } = useData()
61+
</script>
62+
63+
<template>
64+
<img :src="withBase(theme.logoPath)" />
65+
</template>
66+
```

docs/ja/guide/cms.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
---
2+
outline: deep
3+
---
4+
5+
# CMS との接続 {#connecting-to-a-cms}
6+
7+
## 全体のワークフロー {#general-workflow}
8+
9+
VitePress を CMS と接続する際は、主に [動的ルーティング](./routing#dynamic-routes) を中心に考えることになります。先にその仕組みを理解しておいてください。
10+
11+
CMS ごとに動作が異なるため、ここでは各自の環境に合わせて調整できる汎用的なワークフローのみを示します。
12+
13+
1. CMS が認証を必要とする場合は、API トークンを格納するための `.env` を作成し、次のように読み込みます。
14+
15+
```js
16+
// posts/[id].paths.js
17+
import { loadEnv } from 'vitepress'
18+
19+
const env = loadEnv('', process.cwd())
20+
```
21+
22+
2. CMS から必要なデータを取得し、適切なパスデータの形式に整形します。
23+
24+
```js
25+
export default {
26+
async paths() {
27+
// 必要に応じて各 CMS のクライアントライブラリを使用
28+
const data = await (await fetch('https://my-cms-api', {
29+
headers: {
30+
// 必要ならトークン
31+
}
32+
})).json()
33+
34+
return data.map(entry => {
35+
return {
36+
params: { id: entry.id, /* title, authors, date など */ },
37+
content: entry.content
38+
}
39+
})
40+
}
41+
}
42+
```
43+
44+
3. ページ内でコンテンツをレンダリングします。
45+
46+
```md
47+
# {{ $params.title }}
48+
49+
- {{ $params.date }} に {{ $params.author }} が作成
50+
51+
<!-- @content -->
52+
```
53+
54+
## 連携ガイドの募集 {#integration-guides}
55+
56+
特定の CMS と VitePress の連携ガイドを書かれた方は、下部の「Edit this page」リンクからぜひ投稿してください!

0 commit comments

Comments
 (0)