Skip to content

翻译 v2 教师指南至简体中文 - #1568

Open
GanLuy1223 wants to merge 3 commits into
processing:mainfrom
GanLuy1223:translate-v2-guide
Open

翻译 v2 教师指南至简体中文#1568
GanLuy1223 wants to merge 3 commits into
processing:mainfrom
GanLuy1223:translate-v2-guide

Conversation

@GanLuy1223

Copy link
Copy Markdown

此 PR 将 v2_transition 教程翻译为简体中文,以便更多中文用户学习。

@ksen0

ksen0 commented Aug 10, 2026

Copy link
Copy Markdown
Member

Thanks! Just adding a note that this follows up on #1526 -cc @lirenjie95

@lirenjie95 lirenjie95 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for the translation! A few things to fix before this can merge:

  1. CI failure: line 48 changed the image path from ../images/2.0/v2-libman.png to https://images/2.0/v2-libman.png. Astro rejects unconfigured remote images, so the build fails with RemoteImageNotAllowed. Reverting to the relative path fixes it.
  2. Line 225: await was mistranslated as async — this is the core concept of the tutorial, please fix it.
  3. Typos: a mid-sentence period and "更新迭代码" (line 34), unclosed backticks around preload() (lines 204/206), "兼容性加组件" → "兼容性附加组件" (line 188), an extra "的" (line 46), and a stray leading space in the title (line 2).

See my review below for inline details. Thanks again!

@lirenjie95 lirenjie95 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Inline comments are shown below.

* 你可以**开启兼容性附加组件**
* 你可以在编辑器中的 **将草图切换回 p5.js v1**

![p5.js Web 编辑器版本选择器截图,显示版本列表](https://images/2.0/v2-libman.png)

@lirenjie95 lirenjie95 Aug 11, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

这就是 GitHub Action build 失败的原因。 原文这里是相对路径 ../images/2.0/v2-libman.png,你的版本中 .. 被误写成了 https:,导致 Astro 把它当作远程图片,构建时报 AstroError: RemoteImageNotAllowed。改回 ../images/2.0/v2-libman.png 即可修复 CI。


### p5.js v2 中的 `async` 和 `await`

在 p5.js v2 中,不再使用 `preload()`,而是使用 `async setup()` 内部的 `async` 来加载资源。这适用于图像、声音、字体和其他文件:

@lirenjie95 lirenjie95 Aug 11, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

核心概念误译:原文是 "assets are loaded using await inside async setup()",这里的第二个 async 应为 await,即"而是使用 async setup() 内部的 await 来加载资源"。await 是本篇教程的核心概念,请务必修正。


尽管存在 [其他 v2 更新](https://github.com/processing/p5.js-compatibility) (例如对曲线形状、文本测量和工具函数的更改),但这些通常不会出现在初中或高中课程中,也不太可能影响你与学生的教学工作。

本指南只带你了解你在中学 (MS) 或高中 (HS) 课堂上可能。遇到的更改。你将学习如何为 p5.js v2 更新迭代码,以及兼容性附加组件可能对旧草图有所帮助。

@lirenjie95 lirenjie95 Aug 11, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

几处问题:

  1. "可能。遇到的更改" —— 句号误插入句中,应删去;
  2. "更新迭代码" —— 错字,应为"更新代码";
  3. 原文 "when compatibility add-ons might be helpful for older sketches" 中"何时"的含义丢失了,建议补译,如"以及何时使用兼容性附加组件可能对旧草图有帮助"。

在 p5.js v1 中, 这是通过使用 `preload()` 来完成的。
在 p5.js v2 中,我们在 `setup()` 内部使用 `async` 和 `await`。

### p5.js v1中的`preload’

@lirenjie95 lirenjie95 Aug 11, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

这里的反引号没有正确闭合:结尾用了弯引号 ' 而不是反引号,而且丢失了 ()。应为 `preload()`,否则行内代码渲染会出错。


### p5.js v1中的`preload’

在 p5.js v1中,preload()` 会阻止草图运行,直到其内部的所有内容加载完成:

@lirenjie95 lirenjie95 Aug 11, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

"preload()" 前面丢失了开头的反引号,应为 `preload()`

</table>


### 兼容性加组件 (可选)

@lirenjie95 lirenjie95 Aug 11, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

错字:"兼容性加组件" 应为 "兼容性附加组件"。


* 你可以使用本指南中的示例 **更新草图**
* 你可以**开启兼容性附加组件**
* 你可以在编辑器中的 **将草图切换回 p5.js v1**

@lirenjie95 lirenjie95 Aug 11, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

多了一个"的"字,应为"在编辑器中将草图切换回 p5.js v1"。

@@ -0,0 +1,459 @@
---
title: " p5.js v2教师指南"

@lirenjie95 lirenjie95 Aug 11, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

title 开头多了一个空格,且 v2 与中文之间建议加空格:"p5.js v2 教师指南"

description: 面向初中和高中教育工作者从先前版本过渡到 p5.js 版本 2 的指南。
category: "2.0"
featuredImage: ../images/featured/v2-transition.gif
featuredImageAlt: 待优化图片

@lirenjie95 lirenjie95 Aug 11, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

原文 TODO BETTER IMAGE 是维护者留的待办占位标记,建议保留原文不要翻译,以便后续追踪替换图片。

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I did leave it but it wasn't intentional. Although it could use improvement, I added in english: #1575 Please feel free to use that text ("Animated diagram of API changes between v1 and v2 of p5.js") or similar

@ksen0

ksen0 commented Sep 1, 2026

Copy link
Copy Markdown
Member

Hi @GanLuy1223 thanks for your work on this! Can you confirm if you're still working on this please? Please respond by end of day September 8th; if you don't have time to finish this up, that's no problem, we will finish it and merge it in, so all the different translations are available to teachers as the new school year starts!

@lirenjie95 thanks as always for the edits! I am not sure but I don't think you have permissions to edit the PR, right? Assuming no, if we don't hear back from the original translator I could put in your suggestions and re-request review.

@lirenjie95

Copy link
Copy Markdown
Member

@ksen0 Hi Kit, I'm happy to help with the edit and I don't have the permission now.

@ksen0

ksen0 commented Sep 2, 2026

Copy link
Copy Markdown
Member

@lirenjie95 I think it should be possible for you to make a PR targeting the GanLuy1223:translate-v2-guide branch, then I can merge that into this, and then this could be merged? Does that work for you? I couldn't find an obvious way to permit you to edit a specific PR

@lirenjie95

Copy link
Copy Markdown
Member

Hi @ksen0, I've created a PR targeting the GanLuy1223:translate-v2-guide branch with all the review fixes applied: GanLuy1223#1

It addresses all inline comments: the image path typo causing the CI failure (RemoteImageNotAllowed), the await mistranslation, the typos, the unclosed backticks, and uses the featured image alt text from #1575. Build passes locally (npm run build, 6320 pages).

Once that's merged into this branch, this PR should be ready for a final review.

- Fix image path typo (https: -> ../) causing RemoteImageNotAllowed build failure
- Fix mistranslation of 'await' (was 'async') in the asset loading section
- Fix typos: mid-sentence period, 更新迭代码, 兼容性加组件, extra 的
- Fix unclosed/missing backticks around preload()
- Fix leading space in title and add space between v2 and Chinese
- Use proper alt text for featured image (matching processing#1575)
@ksen0

ksen0 commented Sep 3, 2026

Copy link
Copy Markdown
Member

Ready for review, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants