Skip to content

Files

Latest commit

 

History

History
46 lines (24 loc) · 983 Bytes

nslocalizedstring_require_bundle.md

File metadata and controls

46 lines (24 loc) · 983 Bytes

Pattern: Missing bundle for NSLocalizedString

Issue: -

Description

Calls to NSLocalizedString should specify the bundle which contains the strings file.

Examples of correct code:

NSLocalizedString("someKey", bundle: .main, comment: "test")


NSLocalizedString("someKey", tableName: "a",
                  bundle: Bundle(for: A.self),
                  comment: "test")


NSLocalizedString("someKey", tableName: "xyz",
                  bundle: someBundle, value: "test"
                  comment: "test")


arbitraryFunctionCall("something")

Examples of incorrect code:

NSLocalizedString("someKey", comment: "test")


NSLocalizedString("someKey", tableName: "a", comment: "test")


NSLocalizedString("someKey", tableName: "xyz",
                  value: "test", comment: "test")

Further Reading