mirror of
https://github.com/bitwarden/ios.git
synced 2025-12-10 17:46:07 -06:00
19 lines
800 B
Swift
19 lines
800 B
Swift
import Foundation
|
|
|
|
/// Utility and factory methods for handling shared resources
|
|
///
|
|
public class Resources {
|
|
/// The language code at initialization.
|
|
public static var initialLanguageCode: String?
|
|
|
|
/// Override SwiftGen's lookup function in order to determine the language manually.
|
|
public static func localizationFunction(key: String, table: String, fallbackValue: String) -> String {
|
|
if let languageCode = initialLanguageCode,
|
|
let path = Bundle(for: Resources.self).path(forResource: languageCode, ofType: "lproj"),
|
|
let bundle = Bundle(path: path) {
|
|
return bundle.localizedString(forKey: key, value: fallbackValue, table: table)
|
|
}
|
|
return Bundle.main.localizedString(forKey: key, value: fallbackValue, table: table)
|
|
}
|
|
}
|