@@ -42,10 +42,11 @@ public let NSNotFound: Int = .max
42
42
/// - parameter value: A user-visible string to return when the localized string
43
43
/// for `key` can't be found in the table. The default value is the empty
44
44
/// 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".
49
50
///
50
51
/// - returns: A localized version of the string designated by `key` in the
51
52
/// table identified by `tableName`. If the localized string for `key` cannot
@@ -148,21 +149,32 @@ public let NSNotFound: Int = .max
148
149
/// + "this other string literal works just fine.",
149
150
/// comment: "The description of a sample of code.")
150
151
///
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`.
153
154
///
154
155
/// Alternatives
155
156
/// ------------
156
157
///
157
158
/// If having Xcode generate strings files from code isn't desired behavior,
158
159
/// 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.
161
160
///
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:)`.
166
178
public
167
179
func NSLocalizedString( _ key: String ,
168
180
tableName: String ? = nil ,
0 commit comments