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

zh-CN: translate Svelte TypeScript tutorial #18276

Merged
merged 11 commits into from
Mar 8, 2024
Merged

Conversation

hanyujie2002
Copy link
Contributor

@hanyujie2002 hanyujie2002 commented Feb 20, 2024

Related issues and pull requests

Relates to #16965

@hanyujie2002 hanyujie2002 requested a review from a team as a code owner February 20, 2024 03:29
@hanyujie2002 hanyujie2002 requested review from yin1999 and removed request for a team February 20, 2024 03:29
@github-actions github-actions bot added the l10n-zh Issues related to Chinese content. label Feb 20, 2024
Copy link
Contributor

github-actions bot commented Feb 20, 2024

Preview URLs

Flaws (15)

URL: /zh-CN/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Svelte_TypeScript
Title: Svelte 对 TypeScript 的支持
Flaw count: 15

  • macros:
    • /zh-CN/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/React_interactivity_events_state does not exist but fell back to /en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/React_interactivity_events_state
    • /zh-CN/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/React_interactivity_filtering_conditional_rendering does not exist but fell back to /en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/React_interactivity_filtering_conditional_rendering
    • /zh-CN/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/React_accessibility does not exist but fell back to /en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/React_accessibility
    • /zh-CN/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/React_resources does not exist but fell back to /en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/React_resources
    • /zh-CN/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Ember_getting_started does not exist but fell back to /en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Ember_getting_started
    • and 10 more flaws omitted
External URLs (16)

URL: /zh-CN/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Svelte_TypeScript
Title: Svelte 对 TypeScript 的支持

(comment last updated: 2024-03-08 04:23:36)

@yin1999 yin1999 added the needs content update Needs update to the content to support this change. label Feb 20, 2024
@yin1999 yin1999 marked this pull request as draft February 20, 2024 06:57
@yin1999
Copy link
Member

yin1999 commented Feb 20, 2024

Please convert this PR to ready when the upstream PRs have been merged

@hanyujie2002 hanyujie2002 marked this pull request as ready for review March 5, 2024 11:55
@hanyujie2002 hanyujie2002 marked this pull request as draft March 5, 2024 11:56
@hanyujie2002 hanyujie2002 marked this pull request as ready for review March 6, 2024 07:42
@yin1999 yin1999 removed the needs content update Needs update to the content to support this change. label Mar 6, 2024
</h2>
```

这样,TypeScript 可以防止我们错误地将其分配给字符串变量。
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Suggested change
这样,TypeScript 可以防止我们错误地将其分配给字符串变量
这样,TypeScript 可以防止我们将其错误地分配给字符串

Copy link
Member

Choose a reason for hiding this comment

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

这里说的是,防止将“字符串值”赋给“tabindex”这个属性(该属性接受的值是 Number 类型)。只是因为 HTML 允许使用字符串值,也允许使用数字(但实际该属性接受的字符串也应该表示一个数字)。

你建议的翻译并没有体现这个意思,请参考一下我上面给出的翻译。

一旦你配置好了 TypeScript,你就可以通过在组件的脚本部分开头添加 `<script lang='ts'>` 来在 Svelte 组件中使用它。要通过常规的 JavaScript 文件使用它,只需将文件扩展名从 `.js` 更改为 `.ts`。你还需要更新所有相应的导入语句,将 `import` 语句中的 `.ts` 文件扩展名删除。

> **备注:** 如果在 `import` 语句中使用 `.ts` 文件扩展名,TypeScript 会抛出错误,因此如果你有名为 `./foo.ts` 的文件,你必须将其导入为 `"./foo"`。
> 更多信息请参阅 TypeScript 手册中的[捆绑程序、TypeScript 运行时和 Node.js 加载器的模块解析](https://www.typescriptlang.org/docs/handbook/2/modules.html##module-resolution-for-bundlers-typescript-runtimes-and-nodejs-loaders)部分。
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Suggested change
> 更多信息请参阅 TypeScript 手册中的[捆绑程序、TypeScript 运行时和 Node.js 加载器的模块解析](https://www.typescriptlang.org/docs/handbook/2/modules.html##module-resolution-for-bundlers-typescript-runtimes-and-nodejs-loaders)部分。
> 更多信息请参阅 TypeScript 手册中的[捆绑程序、TypeScript 运行时和 Node.js 加载器的模块解析](https://www.typescriptlang.org/docs/handbook/modules/theory.html#module-resolution-for-bundlers-typescript-runtimes-and-nodejs-loaders)部分。

Copy link
Member

@yin1999 yin1999 Mar 8, 2024

Choose a reason for hiding this comment

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

</h2>
```

这样,TypeScript 可以防止我们将其错误地分配给字符串。
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Suggested change
这样,TypeScript 可以防止我们将其错误地分配给字符串
这样,TypeScript 可以防止我们将其分配为错误的字符串

Copy link
Member

Choose a reason for hiding this comment

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

这里用“赋值”就行,分配我们一般用在“内存空间”的分配,而非“使得某个变量的值变成另一个”

@hanyujie2002
Copy link
Contributor Author

Should we convert this pr into draft and wait for upstream update? @yin1999

@yin1999 yin1999 added the needs content update Needs update to the content to support this change. label Mar 8, 2024
@yin1999
Copy link
Member

yin1999 commented Mar 8, 2024

Should we convert this pr into draft and wait for upstream update? @yin1999

No. I believe the upstream PR will be merged shortly :)

Copy link
Member

@yin1999 yin1999 left a comment

Choose a reason for hiding this comment

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

Thank you @hanyujie2002

@yin1999 yin1999 removed the needs content update Needs update to the content to support this change. label Mar 8, 2024
@yin1999 yin1999 merged commit f53d5d5 into mdn:main Mar 8, 2024
7 checks passed
ciyoe pushed a commit to ciyoe/translated-content that referenced this pull request Apr 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
l10n-zh Issues related to Chinese content.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants