<!--
{
  "availability" : [
    "iOS: 2.0.0 -",
    "iPadOS: 2.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.0.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSString/initWithFormat:locale:",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSString(im)initWithFormat:locale:"
  },
  "title" : "initWithFormat:locale:"
}
-->

# initWithFormat:locale:

Returns an `NSString` object initialized by using a given format string as a template into which the remaining argument values are substituted according to given locale.

```
- (instancetype) initWithFormat:(NSString *) format locale:(id) locale;
```

## Parameters

`format`

A format string. See [Formatting String Objects](https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/Strings/Articles/FormatStrings.html#//apple_ref/doc/uid/20000943) for examples of how to use this method, and [String Format Specifiers](https://developer.apple.com/library/archive/documentation/CoreFoundation/Conceptual/CFStrings/formatSpecifiers.html#//apple_ref/doc/uid/TP40004265) for a list of format specifiers. This value must not be `nil`.
  
  > Important:
  > Raises an `NSInvalidArgumentException` if `format` is `nil`.

`locale`

An [`NSLocale`](/documentation/Foundation/NSLocale) object specifying the locale to use. To use the current locale, pass `[NSLocale currentLocale]`. To use the system locale, pass `nil`.

    For legacy support, this may be an instance of     `NSDictionary`     containing locale information.

## Discussion

Pass comma-separated list of trailing variadic arguments to substitute into `format`.

Invokes [`init(format:locale:arguments:)`](/documentation/Foundation/NSString/init(format:locale:arguments:)) with `locale` as the locale.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)