Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

i18n(zh-cn): Update some integrations #10632

Merged
merged 5 commits into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/content/docs/zh-cn/guides/integrations-guide/alpinejs.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ Astro 包含了一个 `astro add` 命令,用于自动设置官方集成。如
</Fragment>
</PackageManagerTabs>

大多数包管理器会自动安装相关的 peer 依赖项。然而,如果在启动 Astro 时看到 "Cannot find package 'alpinejs'"(或者类似)的警告,则需要手动安装 Alpine.js:
大多数包管理器会自动安装相关的 peer 依赖项。然而,如果在启动 Astro 时看到 `Cannot find package 'alpinejs'`(或者类似)的警告,则需要手动安装 Alpine.js:

<PackageManagerTabs>
<Fragment slot="npm">
Expand All @@ -83,13 +83,13 @@ Astro 包含了一个 `astro add` 命令,用于自动设置官方集成。如

然后,使用 `integrations` 属性将集成应用到你的 `astro.config.*` 文件中:

```js ins="alpine()" title="astro.config.mjs" ins={2}
```js ins="alpinejs()" title="astro.config.mjs" ins={2}
import { defineConfig } from 'astro/config';
import alpine from '@astrojs/alpinejs';
import alpinejs from '@astrojs/alpinejs';

export default defineConfig({
// ...
integrations: [alpine()],
integrations: [alpinejs()],
});
```

Expand Down
16 changes: 15 additions & 1 deletion src/content/docs/zh-cn/guides/integrations-guide/preact.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ Astro 包含了一个 `astro add` 命令,用于自动设置官方集成。如
</Fragment>
</PackageManagerTabs>

大多数包管理器也会安装相关的对等依赖。如果在启动 Astro 时看到 "Cannot find package 'preact'"(或类似)的警告,你需要安装 Preact:
大多数包管理器也会安装相关的对等依赖。如果在启动 Astro 时看到 `Cannot find package 'preact'`(或类似)的警告,你需要安装 Preact:

<PackageManagerTabs>
<Fragment slot="npm">
Expand Down Expand Up @@ -102,6 +102,20 @@ export default defineConfig({
});
```

然后添加下面的代码到 `tsconfig.json` 文件中。

```json title="tsconfig.json" ins={5-8}
{
"extends": "astro/tsconfigs/strict",
"include": [".astro/types.d.ts", "**/*"],
"exclude": ["dist"],
"compilerOptions": {
"jsx": "react-jsx",
"jsxImportSource": "preact"
}
}
```

## 使用

要在 Astro 中使用你的第一个 Preact 组件,请前往我们的 [UI 框架文档][astro-ui-frameworks]。你将会了解到:
Expand Down
22 changes: 18 additions & 4 deletions src/content/docs/zh-cn/guides/integrations-guide/react.mdx
liruifengv marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -60,22 +60,22 @@ Astro 包含了一个 `astro add` 命令,用于自动设置官方集成。如
</Fragment>
</PackageManagerTabs>

大多数包管理器也会安装相关的对等依赖。如果在启动 Astro 时看到 "Cannot find package 'react'"(或类似)的警告,你需要安装 `react` 和 `react-dom`:
大多数包管理器也会安装相关的对等依赖。如果在启动 Astro 时看到 `Cannot find package 'react'`(或类似)的警告,你需要安装 `react` 和 `react-dom`:

<PackageManagerTabs>
<Fragment slot="npm">
```sh
npm install react react-dom
npm install react react-dom @types/react @types/react-dom
```
</Fragment>
<Fragment slot="pnpm">
```sh
pnpm add react react-dom
pnpm add react react-dom @types/react @types/react-dom
```
</Fragment>
<Fragment slot="yarn">
```sh
yarn add react react-dom
yarn add react react-dom @types/react @types/react-dom
```
</Fragment>
</PackageManagerTabs>
Expand All @@ -91,6 +91,20 @@ export default defineConfig({
});
```

然后添加下面的代码到 `tsconfig.json` 文件中。

```json title="tsconfig.json" ins={5-8}
{
"extends": "astro/tsconfigs/strict",
"include": [".astro/types.d.ts", "**/*"],
"exclude": ["dist"],
"compilerOptions": {
"jsx": "react-jsx",
"jsxImportSource": "react"
}
}
```

## 入门指南

要在 Astro 中使用你的第一个 React 组件,请前往我们的[UI 框架文档][astro-ui-frameworks]。你将了解:
Expand Down
21 changes: 18 additions & 3 deletions src/content/docs/zh-cn/guides/integrations-guide/solid-js.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,30 @@ Astro 包含了一个 `astro add` 命令,用于自动设置官方集成。如

然后,使用 `integrations` 属性将集成应用到你的 `astro.config.*` 文件中:

```js title="astro.config.mjs" ins={2} ins="solid()"
```js title="astro.config.mjs" ins={2} ins="solidJs()"
import { defineConfig } from 'astro/config';
import solid from '@astrojs/solid-js';
import solidJs from '@astrojs/solid-js';
export default defineConfig({
// ...
integrations: [solid()],
integrations: [solidJs()],
});
```

然后添加下面的代码到 `tsconfig.json` 文件中。


```json title="tsconfig.json" ins={5-8}
{
"extends": "astro/tsconfigs/strict",
"include": [".astro/types.d.ts", "**/*"],
"exclude": ["dist"],
"compilerOptions": {
"jsx": "preserve",
"jsxImportSource": "solid-js"
}
}
```

## 入门

要在 Astro 使用你的 SolidJS 组件,你可以移步我们的 [UI 框架文档][astro-ui-frameworks]. 你将会了解到:
Expand Down
18 changes: 14 additions & 4 deletions src/content/docs/zh-cn/guides/integrations-guide/svelte.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -61,22 +61,22 @@ Astro 包含了一个 `astro add` 命令,用于自动设置官方集成。如
</Fragment>
</PackageManagerTabs>

大多数包管理器也会安装相关的对等依赖项。如果在启动 Astro 时看到 "Cannot find package 'svelte'" (或类似的)警告,则需要安装 Svelte:
大多数包管理器也会安装相关的对等依赖项。如果在启动 Astro 时看到 `Cannot find package 'svelte'` (或类似的)警告,则需要安装 Svelte 和 TypeScript

<PackageManagerTabs>
<Fragment slot="npm">
```sh
npm install svelte
npm install svelte typescript
```
</Fragment>
<Fragment slot="pnpm">
```sh
pnpm add svelte
pnpm add svelte typescript
```
</Fragment>
<Fragment slot="yarn">
```sh
yarn add svelte
yarn add svelte typescript
```
</Fragment>
</PackageManagerTabs>
Expand All @@ -92,6 +92,16 @@ export default defineConfig({
});
```

然后,在你的项目根目录中创建一个名为 `svelte.config.js` 的文件,并添加以下代码:

```js title="svelte.config.js"
import { vitePreprocess } from '@astrojs/svelte';

export default {
preprocess: vitePreprocess(),
}
```

## 入门

要在 Astro 使用你的 Svelte 组件,你可以移步我们的 [UI 框架文档][astro-ui-frameworks]. 你将会了解到:
Expand Down
2 changes: 1 addition & 1 deletion src/content/docs/zh-cn/guides/integrations-guide/vue.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ Astro 包含了一个 `astro add` 命令,用于自动设置官方集成。如
</PackageManagerTabs>


大多数包管理器也会安装相关的对等依赖项。如果在启动 Astro 时看到 "Cannot find package 'vue'" (或类似的)警告,则需要安装 Vue:
大多数包管理器也会安装相关的对等依赖项。如果在启动 Astro 时看到 `Cannot find package 'vue'` (或类似的)警告,则需要安装 Vue:

<PackageManagerTabs>
<Fragment slot="npm">
Expand Down
Loading