Skip to content

Commit 002557d

Browse files
author
Anton Pogonets
committed
Dont use bundle in NSLocalizedString for android
1 parent 03393fa commit 002557d

File tree

2 files changed

+17
-13
lines changed

2 files changed

+17
-13
lines changed

Foundation/NSString.swift

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,22 @@ extension unichar : ExpressibleByUnicodeScalarLiteral {
2121
}
2222

2323
/// Returns a localized string, using the main bundle if one is not specified.
24-
public
25-
func NSLocalizedString(_ key: String,
26-
tableName: String? = nil,
27-
bundle: Bundle = Bundle.main,
28-
value: String = "",
29-
comment: String) -> String {
30-
#if os(Android)
31-
return key
32-
#else
33-
return bundle.localizedString(forKey: key, value: value, table: tableName)
34-
#endif
24+
#if os(Android)
25+
public func NSLocalizedString(_ key: String,
26+
tableName: String? = nil,
27+
value: String = "",
28+
comment: String) -> String {
29+
return key
3530
}
31+
#else
32+
public func NSLocalizedString(_ key: String,
33+
tableName: String? = nil,
34+
bundle: Bundle = Bundle.main,
35+
value: String = "",
36+
comment: String) -> String {
37+
return bundle.localizedString(forKey: key, value: value, table: tableName)
38+
}
39+
#endif
3640

3741
#if os(OSX) || os(iOS)
3842
internal let kCFStringEncodingMacRoman = CFStringBuiltInEncodings.macRoman.rawValue

Foundation/URLSession/http/HTTPURLProtocol.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ fileprivate extension _HTTPURLProtocol {
197197
self?.completeTask(withError: urlError)
198198
self?.client?.urlProtocol(self!, didFailWithError: urlError)
199199
}
200-
guard let task = self.task else { fatalError() }
200+
guard let task = self.task else { fatalError() }
201201
easyHandle.timeoutTimer = _TimeoutSource(queue: task.workQueue, milliseconds: timeoutInterval, handler: timeoutHandler)
202202

203203
easyHandle.set(automaticBodyDecompression: true)
@@ -344,7 +344,7 @@ internal extension _HTTPURLProtocol {
344344
NSURLErrorFailingURLErrorKey: $0,
345345
NSURLErrorFailingURLStringErrorKey: $0.absoluteString,
346346
NSLocalizedDescriptionKey: error.localizedDescription
347-
]
347+
]
348348
}
349349
let urlError = URLError(_nsError: NSError(domain: NSURLErrorDomain, code: error.code, userInfo: userInfo))
350350
completeTask(withError: urlError)

0 commit comments

Comments
 (0)