Skip to content

Commit da2abb7

Browse files
committed
---
yaml --- r: 341438 b: refs/heads/rxwei-patch-1 c: e595b44 h: refs/heads/master
1 parent 8c672bf commit da2abb7

File tree

2 files changed

+25
-13
lines changed

2 files changed

+25
-13
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1015,7 +1015,7 @@ refs/tags/swift-DEVELOPMENT-SNAPSHOT-2018-08-18-a: b10b1fce14385faa6d44f6b933e95
10151015
refs/heads/rdar-43033749-fix-batch-mode-no-diags-swift-5.0-branch: a14e64eaad30de89f0f5f0b2a782eed7ecdcb255
10161016
refs/heads/revert-19006-error-bridging-integer-type: 8a9065a3696535305ea53fe9b71f91cbe6702019
10171017
refs/heads/revert-19050-revert-19006-error-bridging-integer-type: ecf752d54b05dd0a20f510f0bfa54a3fec3bcaca
1018-
refs/heads/rxwei-patch-1: 8bb63c0c1508825c14e82fe839aa49c2c15c6460
1018+
refs/heads/rxwei-patch-1: e595b44a1066210d14a9d973d36171b5d2937abc
10191019
refs/heads/shahmishal-patch-1: e58ec0f7488258d42bef51bc3e6d7b3dc74d7b2a
10201020
refs/heads/typelist-existential: 4046359efd541fb5c72d69a92eefc0a784df8f5e
10211021
refs/tags/swift-4.2-DEVELOPMENT-SNAPSHOT-2018-08-20-a: 4319ba09e4fb8650ee86061075c74a016b6baab9

branches/rxwei-patch-1/stdlib/public/Darwin/Foundation/Foundation.swift

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,11 @@ public let NSNotFound: Int = .max
4242
/// - parameter value: A user-visible string to return when the localized string
4343
/// for `key` can't be found in the table. The default value is the empty
4444
/// string, which indicates that `key` should be returned.
45-
/// - parameter comment: A note to the translator describing the context in
46-
/// in which this localized string is presented to the user. For example, this
47-
/// can indicate whether the "Book" is used as a noun or a verb. In French,
48-
/// the noun is "Livre", whereas the verb is "Réserver".
45+
/// - parameter comment: A note to the translator describing the context where
46+
/// the localized string is presented to the user. For example, this can
47+
/// indicate whether the "Book" is used as a noun or a verb. This distinction
48+
/// is important when translating to French, where the noun is "Livre" and the
49+
/// verb is "Réserver".
4950
///
5051
/// - returns: A localized version of the string designated by `key` in the
5152
/// table identified by `tableName`. If the localized string for `key` cannot
@@ -148,21 +149,32 @@ public let NSNotFound: Int = .max
148149
/// + "this other string literal works just fine.",
149150
/// comment: "The description of a sample of code.")
150151
///
151-
/// However, since comments aren't localized, multi-line string literals are
152-
/// safe to use for `comment`.
152+
/// Luckily, since comments aren't localized, multi-line string literals can be
153+
/// safely used with `comment`.
153154
///
154155
/// Alternatives
155156
/// ------------
156157
///
157158
/// If having Xcode generate strings files from code isn't desired behavior,
158159
/// you should call `Bundle.localizedString(forKey:value:table:)` instead.
159-
/// Doing so will require the manual creation and management of the relevant
160-
/// strings files.
161160
///
162-
/// It should be noted that both localization methods can be used at the same
163-
/// time, but data from manually managed strings file tables will be overwritten
164-
/// by Xcode if that table is also used with a call to
165-
/// `NSLocaliedString(_:tableName:bundle:value:comment:)`.
161+
/// let greeting = Bundle.localizedString(forKey: "program-greeting",
162+
/// value: "Hello, World!",
163+
/// table: "Localization")
164+
///
165+
/// However, this requires the manual creation and management of that table's
166+
/// strings file.
167+
///
168+
/// /* Localization.strings */
169+
///
170+
/// /* A friendly greeting to the user when the program starts. */
171+
/// "program-greeting" = "Hello, World!";
172+
///
173+
/// **Note:** Although `NSLocalizedString(_:tableName:bundle:value:comment:)`
174+
/// and `Bundle.localizedString(forKey:value:table:)` can be used in a project
175+
/// at the same time, data from a manually managed strings files will be
176+
/// overwritten by Xcode when their table is also used to look up localized
177+
/// strings with `NSLocalizedString(_:tableName:bundle:value:comment:)`.
166178
public
167179
func NSLocalizedString(_ key: String,
168180
tableName: String? = nil,

0 commit comments

Comments
 (0)