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

1335: feat:翻译完 1335 Type Casting⭐️⭐️⭐️⭐️ #1377

Open
wants to merge 2 commits into
base: swift-6-beta-translation
Choose a base branch
from

Conversation

hdmdhr
Copy link
Collaborator

@hdmdhr hdmdhr commented Aug 28, 2024

@hdmdhr hdmdhr self-assigned this Aug 28, 2024
@hdmdhr hdmdhr linked an issue Aug 28, 2024 that may be closed by this pull request
@hdmdhr hdmdhr changed the title feat:翻译完 1335 feat:翻译完 1335 Type Casting Aug 28, 2024
@yongfrank yongfrank changed the title feat:翻译完 1335 Type Casting 1335: feat:翻译完 1335 Type Casting⭐️⭐️⭐️⭐️ Sep 22, 2024
@yongfrank
Copy link

@Shinolr @brooklyn1999 有空请帮忙 Review Thx!

swift-6-beta.docc/LanguageGuide/TypeCasting.md Outdated Show resolved Hide resolved
(It's assumed that all media items, including all movies and songs, will have a name.)
第一个代码片段定义了一个名为 `MediaItem` 的新基类。
该类为数字媒体库中出现的任何类型项目提供基本功能。
具体来说,它声明了一个字符串类型的 `name` 属性和一个 `init(name:)` 初始化器。
Copy link
Member

Choose a reason for hiding this comment

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

NIT,“初始化器”在已有的翻译中是比较通用的说法了吗?另外String这种类型关键字的翻译约定是保留还是不保留?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

  • 初始化器先保留了,最后看组织决定是用“构造器”还是“初始化器”。
  • 除非是遇到翻译过来造成不通顺的情况,String 这种关键字尽量保留吧

swift-6-beta.docc/LanguageGuide/TypeCasting.md Outdated Show resolved Hide resolved
swift-6-beta.docc/LanguageGuide/TypeCasting.md Outdated Show resolved Hide resolved
swift-6-beta.docc/LanguageGuide/TypeCasting.md Outdated Show resolved Hide resolved
swift-6-beta.docc/LanguageGuide/TypeCasting.md Outdated Show resolved Hide resolved
and queries the type of each item with a `switch` statement.
Several of the `switch` statement's cases bind their matched value to
a constant of the specified type to enable its value to be printed:
`things` 数组包含两个 `Int` 值、两个 `Double` 值、一个 `String` 值、一个类型为 `(Double, Double)` 的元组、电影 “捉鬼敢死队”,
Copy link
Member

Choose a reason for hiding this comment

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

这里不要直译“电影捉鬼敢死队”,可以是“movie实例”,名称翻不翻无所谓

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

我觉着这里可以用译名吧,因为原文用的不是字符串的直立引号"",我觉得翻译出来更容易读者理解(和安利)。

以及一个接收字符串值并返回另一个字符串值的闭包表达式。


如果常量或变量的已知类型是 `Any` 或 `AnyObject`,要确定其具体类型,可以在 switch 语句的情况下使用 `is` 或 `as` 模式。
Copy link
Member

Choose a reason for hiding this comment

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

switch-case中的case不应该翻译,应保留

swift-6-beta.docc/LanguageGuide/TypeCasting.md Outdated Show resolved Hide resolved
swift-6-beta.docc/LanguageGuide/TypeCasting.md Outdated Show resolved Hide resolved
@Pancf Pancf self-requested a review September 28, 2024 04:03
@hdmdhr hdmdhr self-assigned this Oct 10, 2024
@yongfrank
Copy link

@Pancf 可以再看一眼,没问题就 Approve Merge, Thx!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Under Review
Development

Successfully merging this pull request may close these issues.

LanguageGuide / type-casting.md ⭐️⭐️⭐️⭐️
3 participants