LocalizationBundle
open class LocalizationBundle : NSObject
LocalizationBundle
is a wrapper for returning a bundle along with a table name and target suffixes.
This is used by the Localization
class to return localized strings that are defined in a strings
file embedded in the given bundle.
-
The bundle to check for a localized string.
Declaration
Swift
public let bundle: Bundle
-
The table name used as the parameter of the
NSLocalizedString
method.Declaration
Swift
public let tableName: String?
-
Any additional target suffixes to remove from the table name in order to search for a shared strings file.
Declaration
Swift
public let targetSuffixes: [String]
-
Convenience initializer that uses the default
tableName
andtargetSuffixes
.Declaration
Swift
public convenience init(_ bundle: Bundle)
Parameters
bundle
The bundle to check for a localized string.
-
Convenience initializer that uses the default
tableName
andtargetSuffixes
.Declaration
Swift
public init(bundle: Bundle, tableName: String?, targetSuffixes: [String] = [])
Parameters
bundle
The bundle to check for a localized string.
tableName
The table name used as the parameter of the
NSLocalizedString
method.targetSuffixes
Any additional target suffixes to remove from the table name in order to search for a shared strings file.
-
Find the localized string in this bundle (if any) with the given key.
Declaration
Swift
open func findLocalizedString(for key: String) -> String?
Parameters
key
The key into the
Strings
file.Return Value
The localized string or
nil
if not found.