Skip to content

Commit fc0d080

Browse files
committed
fix: comment translation
1 parent cc143dc commit fc0d080

File tree

1 file changed

+26
-23
lines changed

1 file changed

+26
-23
lines changed

swift-6-beta.docc/ReferenceManual/Attributes.md

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -206,9 +206,9 @@ TODO TR: Is there any more detail about this case?
206206
表明声明已被重命名。
207207

208208
```swift
209-
// First release
209+
// 首个版本
210210
protocol MyProtocol {
211-
// protocol definition
211+
// 协议定义
212212
}
213213
```
214214

@@ -225,9 +225,9 @@ TODO TR: Is there any more detail about this case?
225225
-->
226226

227227
```swift
228-
// Subsequent release renames MyProtocol
228+
// 后续版本将 MyProtocol 重命名为 MyRenamedProtocol
229229
protocol MyRenamedProtocol {
230-
// protocol definition
230+
// 协议定义
231231
}
232232

233233
@available(*, unavailable, renamed: "MyRenamedProtocol")
@@ -411,14 +411,14 @@ struct TelephoneExchange {
411411

412412
let dial = TelephoneExchange()
413413

414-
// Use a dynamic method call.
414+
// 使用动态方法调用
415415
dial(4, 1, 1)
416-
// Prints "Get Swift help on forums.swift.org"
416+
// 打印 "Get Swift help on forums.swift.org"
417417

418418
dial(8, 6, 7, 5, 3, 0, 9)
419-
// Prints "Unrecognized number"
419+
// 打印 "Unrecognized number"
420420

421-
// Call the underlying method directly.
421+
// 直接调用内部的方法
422422
dial.dynamicallyCall(withArguments: [4, 1, 1])
423423
```
424424

@@ -589,15 +589,16 @@ struct DynamicStruct {
589589
}
590590
let s = DynamicStruct()
591591

592-
// Use dynamic member lookup.
592+
// 使用动态成员查询
593593
let dynamic = s.someDynamicMember
594594
print(dynamic)
595-
// Prints "325"
595+
// 打印 "325"
596596

597-
// Call the underlying subscript directly.
597+
// 直接调用底层下标
598598
let equivalent = s[dynamicMember: "someDynamicMember"]
599599
print(dynamic == equivalent)
600-
// Prints "true"
600+
// 打印 "true"
601+
601602
```
602603

603604
<!--
@@ -910,9 +911,10 @@ https://github.com/apple/swift/blob/main/stdlib/public/core/Macros.swift#L102
910911
@main
911912
struct MyTopLevel {
912913
static func main() {
913-
// Top-level code goes here
914+
// 顶层代码在此处编写
914915
}
915916
}
917+
916918
```
917919

918920
<!--
@@ -1109,7 +1111,7 @@ Objective-C 代码,名称为 `isEnabled`,
11091111
class ExampleClass: NSObject {
11101112
@objc var enabled: Bool {
11111113
@objc(isEnabled) get {
1112-
// Return the appropriate value
1114+
// 返回适当的值
11131115
}
11141116
}
11151117
}
@@ -1307,13 +1309,13 @@ struct SomeWrapper {
13071309
}
13081310

13091311
struct SomeStruct {
1310-
// Uses init()
1312+
// 使用 init()
13111313
@SomeWrapper var a: Int
13121314

1313-
// Uses init(wrappedValue:)
1315+
// 使用 init(wrappedValue:)
13141316
@SomeWrapper var b = 10
13151317

1316-
// Both use init(wrappedValue:custom:)
1318+
// 二者都使用 init(wrappedValue:custom:)
13171319
@SomeWrapper(custom: 98.7) var c = 30
13181320
@SomeWrapper(wrappedValue: 30, custom: 98.7) var d
13191321
}
@@ -1400,9 +1402,9 @@ struct SomeStruct {
14001402
@WrapperWithProjection var x = 123
14011403
}
14021404
let s = SomeStruct()
1403-
s.x // Int value
1404-
s.$x // SomeProjection value
1405-
s.$x.wrapper // WrapperWithProjection value
1405+
s.x // Int 类型的值
1406+
s.$x // SomeProjection 类型的值
1407+
s.$x.wrapper // WrapperWithProjection 类型的值
14061408
```
14071409

14081410
<!--
@@ -1672,14 +1674,15 @@ struct ArrayBuilder {
16721674
init(_ content: String) { self.content = content }
16731675
func draw() -> String { return content }
16741676
}
1677+
16751678
@DrawingBuilder var brokenDrawing: Drawable {
16761679
if #available(macOS 99, *) {
1677-
FutureText("Inside.future") // Problem
1680+
FutureText("Inside.future") // 问题所在
16781681
} else {
16791682
Text("Inside.present")
16801683
}
16811684
}
1682-
// The type of brokenDrawing is Line<DrawEither<Line<FutureText>, Line<Text>>>
1685+
// brokenDrawing 的类型是 Line<DrawEither<Line<FutureText>, Line<Text>>>
16831686
```
16841687

16851688
<!-- Comment block with swifttest for the code listing above is after the end of this bulleted list, due to tooling limitations. -->
@@ -1714,7 +1717,7 @@ struct ArrayBuilder {
17141717
Text("Inside.present")
17151718
}
17161719
}
1717-
// The type of typeErasedDrawing is Line<DrawEither<AnyDrawable, Line<Text>>>
1720+
// typeErasedDrawing 的类型是 Line<DrawEither<AnyDrawable, Line<Text>>>
17181721
```
17191722

17201723
<!-- Comment block with swifttest for the code listing above is after the end of this bulleted list, due to tooling limitations. -->

0 commit comments

Comments
 (0)