NSLocalizedString Require Bundle

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

  • Identifier: nslocalizedstring_require_bundle
  • Enabled by default: No
  • Supports autocorrection: No
  • Kind: lint
  • Analyzer rule: No
  • Minimum Swift compiler version: 5.0.0
  • Default configuration:
    KeyValue
    severity warning

Non Triggering Examples

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")

Triggering Examples

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