LocalizationBundle
open class LocalizationBundle
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
NSLocalizedStringmethod.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
tableNameandtargetSuffixes.Declaration
Swift
public convenience init(_ bundle: Bundle)Parameters
bundleThe bundle to check for a localized string.
-
Convenience initializer that uses the default
tableNameandtargetSuffixes.Declaration
Swift
public init(bundle: Bundle, tableName: String?, targetSuffixes: [String] = [])Parameters
bundleThe bundle to check for a localized string.
tableNameThe table name used as the parameter of the
NSLocalizedStringmethod.targetSuffixesAny 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
keyThe key into the
Stringsfile.Return Value
The localized string or
nilif not found.
View on GitHub
LocalizationBundle Class Reference