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): Translated astro-syntax.mdx #2982

Merged
merged 27 commits into from
Aug 9, 2023
Merged

Conversation

allenli178
Copy link
Contributor

No description provided.

@netlify
Copy link

netlify bot commented Apr 4, 2023

Deploy Preview for astro-docs-2 ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit d457aa3
🔍 Latest deploy log https://app.netlify.com/sites/astro-docs-2/deploys/64d3de40d92a910008d169a7
😎 Deploy Preview https://deploy-preview-2982--astro-docs-2.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@github-actions github-actions bot added the i18n Anything to do with internationalization & translation efforts - ask @YanThomas for help! label Apr 4, 2023
@yanthomasdev
Copy link
Member

Thanks @allenli178! FYI, this page is marked as i18nReady: false, which means we don't want to have this page translated yet, since it can go through big changes. I'll draft your PR and when this page becomes available for translation I'll open it again. 🙌

@yanthomasdev yanthomasdev marked this pull request as draft April 17, 2023 19:29
@yanthomasdev
Copy link
Member

These pages are now ready for translation, thanks for the patience!

@yanthomasdev yanthomasdev marked this pull request as ready for review July 18, 2023 16:35

### 定义集合模式

模式在集合中强制执行一致的front-matter。模式**保证**当你需要引用或查询它时,你的 frontmatter 以可预测的形式存在。如果任何文件违反了它的集合模式,Astro 将提供一个有用的错误让你知道。

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a missing space between the Chinese and English text.


当使用动态标签时:

- **变量名必须大**。例如,使用 `Element`,而不是 `element`。否则,Astro 将尝试把变量名渲染为文本 HTML 标签。

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

变量名必须大 -> 变量名首字母必须大写?


- **不支持 hydration 指令**。当使用[`client:*` hydration 指令时](/zh-cn/core-concepts/framework-components/#激活组件),Astro 需要知道哪些组件要捆绑到生产环境中,而动态标签模式阻止了这一点。

### 片段及多元素
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some content is outdated. See commit: 6b6f629

@liruifengv
Copy link
Member

liruifengv commented Jul 28, 2023

@allenli178 你好,我们正在组织社区译者来进行 Astro 中文文档的翻译,你是否愿意继续推动这个 PR 的进行呢?如果你因为其他原因不能推进,我们愿意接手过来。期待你的回复。

liruifengv#1

@allenli178
Copy link
Contributor Author

allenli178 commented Jul 28, 2023 via email

@liruifengv
Copy link
Member

@Yan-Thomas Can you make the CI run the check link?

}
---
<!-- ❌ 这样行不通 ❌ -->
<button onClick={handleClick}>Nothing will happen when you click me!</button>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<button onClick={handleClick}>Nothing will happen when you click me!</button>
<button onClick={handleClick}>当你点击我的时候什么都不会发生!</button>

There may be a need for translation here as well.


```astro title="src/components/RootElements.astro"
---
// Template with multiple elements
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// Template with multiple elements
// 包含多个元素的模板

---
// Template with multiple elements
---
<p>No need to wrap elements in a single containing element.</p>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<p>No need to wrap elements in a single containing element.</p>
<p>无需将元素包装在单个包含元素中。</p>

// Template with multiple elements
---
<p>No need to wrap elements in a single containing element.</p>
<p>Astro supports multiple root elements in a template.</p>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<p>Astro supports multiple root elements in a template.</p>
<p>Astro 支持模板中的多个根元素。</p>

@liruifengv
Copy link
Member

liruifengv commented Aug 4, 2023

@allenli178 内容集合页面,自从创建这个 PR 以来,有了很多提交,你可以更新一下吗。
你可以查看4月4号以来的所有 commit 历史:
https://github.com/withastro/docs/commits/main/src/content/docs/en/guides/content-collections.mdx?since=2023-04-04T12:20:31.000Z

另外,这两个页面翻译完成后,其他页面会有大量的 broken link(等待 @Yan-Thomas 运行 CI check link)。希望你也可以在这个 PR 中修复他们。

@allenli178
Copy link
Contributor Author

好的 周末有空我会更新一下的

@allenli178
Copy link
Contributor Author

有一些跨文件的链接。 以 image为例。我要怎么写这样的链接。我试了
image
但是不起作用,只跳转到了相应的页面,但没有跳转到标题。
@liruifengv


## 查询集合

Astro 提供了两个函数来查询一个集合并返回一个(或多个)内容条目: [`getCollection()`](/zh-cn/reference/api-reference/#`getCollection()`)和 [`getEntry()`](/zh-cn/reference/api-reference/#`getEntry()`)。
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Astro 提供了两个函数来查询一个集合并返回一个(或多个)内容条目: [`getCollection()`](/zh-cn/reference/api-reference/#`getCollection()`)[`getEntry()`](/zh-cn/reference/api-reference/#`getEntry()`)
Astro 提供了两个函数来查询一个集合并返回一个(或多个)内容条目: [`getCollection()`](/zh-cn/reference/api-reference/#getcollection)[`getEntry()`](/zh-cn/reference/api-reference/#getentry)

应该是这样,可以在原页面点击右侧目录看一下


3. 创建至少一个集合(`src/content/` 的文件夹中) ,并将 Markdown 和 MDX 页面从 `src/pages/` 移动到 `src/content/` 的这些子目录中。当同一集合中的所有文件具有相似的 fronmatter 属性时,集合的工作效果最好。因此,请选择新的文件夹结构以反映类似类型的页面。

例如,要迁移[教程中的博客文章](/en/tutorial/2-pages/2/) ,请将 `src/pages/post/` 的内容移动到 `src/content/posts/`。
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
例如,要迁移[教程中的博客文章](/en/tutorial/2-pages/2/) ,请将 `src/pages/post/` 的内容移动到 `src/content/posts/`
例如,要迁移[教程中的博客文章](/zh-cn/tutorial/2-pages/2/) ,请将 `src/pages/post/` 的内容移动到 `src/content/posts/`

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tutorial还没有中文翻译

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

会 fallback 到英文

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已修改

如果你的编辑器不能识别 `Astro:content`,请确保使用的是最新版本的 Astro,并尝试重新启动开发服务器。
:::

5. [从集合中生成路由](#从集合中生成路由)。在集合中,Markdown 和 MDX 文件不再使用 Astro 的[基于文件的路由](/zh-cn/guides/markdown-content/#基于文件的路由)自动成为页面,因此必须自己生成页面。
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
5. [从集合中生成路由](#从集合中生成路由)。在集合中,Markdown 和 MDX 文件不再使用 Astro 的[基于文件的路由](/zh-cn/guides/markdown-content/#基于文件的路由)自动成为页面,因此必须自己生成页面。
5. [从集合中生成路由](#从内容生成路由)。在集合中,Markdown 和 MDX 文件不再使用 Astro 的[基于文件的路由](/zh-cn/guides/markdown-content/#基于文件的路由)自动成为页面,因此必须自己生成页面。

Should be #从内容生成路由

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已修改

Co-authored-by: 李瑞丰 <liruifeng1024@gmail.com>
@liruifengv
Copy link
Member

内容大体上可以了。但是其他页面应该有链接会挂掉,不知道为啥 check link 的 CI 没运行。

@yanthomasdev
Copy link
Member

Runned the CI, there's well, lots of broken links! Could you fix them? After doing so I believe we're good to go!

Co-authored-by: 李瑞丰 <liruifeng1024@gmail.com>
@liruifengv
Copy link
Member

@allenli178 一有新的 commit 提交,CI 就重新运行了。你可以在本地全局搜索一下其他页面,有引用到这两个页面的链接的,锚点部分要改成对应中文

@allenli178
Copy link
Contributor Author

ok, 我一会儿有空的时候弄一下。

@allenli178
Copy link
Contributor Author

@liruifengv @Yan-Thomas
Please run the CI to check links.

@liruifengv
Copy link
Member

这里有一个最新的修改 878f1bd

Copy link
Member

@liruifengv liruifengv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@yanthomasdev yanthomasdev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks peeps 🚀

@yanthomasdev yanthomasdev merged commit 371a48d into withastro:main Aug 9, 2023
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
i18n Anything to do with internationalization & translation efforts - ask @YanThomas for help!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants