---
title: NSLocale
framework: foundation
role: symbol
role_heading: Class
path: foundation/nslocale
---

# NSLocale

Information about linguistic, cultural, and technological conventions for use in formatting data for presentation.

## Declaration

```swift
class NSLocale
```

## Overview

Overview In Swift, this object bridges to Locale; use NSLocale when you need reference semantics or other Foundation-specific behavior. You typically use a locale to format and interpret information about and according to the user’s customs and preferences. You can initialize any number of locale instances with init(localeIdentifier:) using one of the locale identifiers found in the availableLocaleIdentifiers array. However, you usually use a locale configured to match the preferences of the current user. Use the current property to get the locale matching the current user’s preferences. If you need to be alerted when the user does make changes to region settings, register for the currentLocaleDidChangeNotification notification. Alternatively, you can use the autoupdatingCurrent property to get a locale that automatically updates with the user’s configuration settings: You can inspect a locale by reading its properties, as listed in Getting Information About a Locale. For properties containing a code or identifier, you can then obtain a string suitable for presentation to the user with the methods listed in Getting Display Information About a Locale. For example, you can report the user’s language as a string localized in that language using the autoupdating locale obtained in the previous example: You frequently use a locale in conjunction with a formatter. For example, the DateFormatter class has a locale property that ensures dates are converted to strings that match the user’s expectations about date formatting. By default, this property indicates the user’s current locale, which is usually the behavior you want, but you can instead set it to another locale instance to obtain a different output. See Data Formatting Guide for more information about working with formatters. NSLocale is toll-free bridged with its Core Foundation counterpart, CFLocale. See Toll-Free Bridging for more information on toll-free bridging. important: The Swift overlay to the Foundation framework provides the Locale structure, which bridges to the NSLocale class. For more information about value types, see Working with Foundation Types.

## Topics

### Initializing a Locale

- [init(localeIdentifier:)](foundation/nslocale/init(localeidentifier:).md)
- [init(coder:)](foundation/nslocale/init(coder:).md)

### Getting the User’s Locale

- [autoupdatingCurrent](foundation/nslocale/autoupdatingcurrent.md)
- [current](foundation/nslocale/current.md)
- [currentLocaleDidChangeNotification](foundation/nslocale/currentlocaledidchangenotification.md)
- [system](foundation/nslocale/system.md)

### Getting Known Identifiers and Codes

- [availableLocaleIdentifiers](foundation/nslocale/availablelocaleidentifiers.md)
- [isoCountryCodes](foundation/nslocale/isocountrycodes.md)
- [isoLanguageCodes](foundation/nslocale/isolanguagecodes.md)
- [isoCurrencyCodes](foundation/nslocale/isocurrencycodes.md)
- [commonISOCurrencyCodes](foundation/nslocale/commonisocurrencycodes.md)

### Converting Between Identifiers

- [canonicalLocaleIdentifier(from:)](foundation/nslocale/canonicallocaleidentifier(from:).md)
- [components(fromLocaleIdentifier:)](foundation/nslocale/components(fromlocaleidentifier:).md)
- [localeIdentifier(fromComponents:)](foundation/nslocale/localeidentifier(fromcomponents:).md)
- [canonicalLanguageIdentifier(from:)](foundation/nslocale/canonicallanguageidentifier(from:).md)
- [localeIdentifier(fromWindowsLocaleCode:)](foundation/nslocale/localeidentifier(fromwindowslocalecode:).md)
- [windowsLocaleCode(fromLocaleIdentifier:)](foundation/nslocale/windowslocalecode(fromlocaleidentifier:).md)

### Getting Information About a Locale

- [localeIdentifier](foundation/nslocale/localeidentifier.md)
- [countryCode](foundation/nslocale/countrycode.md)
- [languageCode](foundation/nslocale/languagecode.md)
- [scriptCode](foundation/nslocale/scriptcode.md)
- [variantCode](foundation/nslocale/variantcode.md)
- [exemplarCharacterSet](foundation/nslocale/exemplarcharacterset.md)
- [collationIdentifier](foundation/nslocale/collationidentifier.md)
- [collatorIdentifier](foundation/nslocale/collatoridentifier.md)
- [usesMetricSystem](foundation/nslocale/usesmetricsystem.md)
- [decimalSeparator](foundation/nslocale/decimalseparator.md)
- [groupingSeparator](foundation/nslocale/groupingseparator.md)
- [currencyCode](foundation/nslocale/currencycode.md)
- [currencySymbol](foundation/nslocale/currencysymbol.md)
- [calendarIdentifier](foundation/nslocale/calendaridentifier.md)
- [quotationBeginDelimiter](foundation/nslocale/quotationbegindelimiter.md)
- [quotationEndDelimiter](foundation/nslocale/quotationenddelimiter.md)
- [alternateQuotationBeginDelimiter](foundation/nslocale/alternatequotationbegindelimiter.md)
- [alternateQuotationEndDelimiter](foundation/nslocale/alternatequotationenddelimiter.md)

### Getting Display Information About a Locale

- [localizedString(forLocaleIdentifier:)](foundation/nslocale/localizedstring(forlocaleidentifier:).md)
- [localizedString(forCountryCode:)](foundation/nslocale/localizedstring(forcountrycode:).md)
- [localizedString(forLanguageCode:)](foundation/nslocale/localizedstring(forlanguagecode:).md)
- [localizedString(forScriptCode:)](foundation/nslocale/localizedstring(forscriptcode:).md)
- [localizedString(forVariantCode:)](foundation/nslocale/localizedstring(forvariantcode:).md)
- [localizedString(forCollationIdentifier:)](foundation/nslocale/localizedstring(forcollationidentifier:).md)
- [localizedString(forCollatorIdentifier:)](foundation/nslocale/localizedstring(forcollatoridentifier:).md)
- [localizedString(forCurrencyCode:)](foundation/nslocale/localizedstring(forcurrencycode:).md)
- [localizedString(forCalendarIdentifier:)](foundation/nslocale/localizedstring(forcalendaridentifier:).md)
- [Locale Calendar Identifiers](foundation/locale-calendar-identifiers.md)

### Accessing Locale Information by Key

- [object(forKey:)](foundation/nslocale/object(forkey:).md)
- [displayName(forKey:value:)](foundation/nslocale/displayname(forkey:value:).md)
- [NSLocale.Key](foundation/nslocale/key.md)

### Getting the User’s Preferred Languages

- [preferredLanguages](foundation/nslocale/preferredlanguages.md)

### Getting Line and Character Direction for a Language

- [characterDirection(forLanguage:)](foundation/nslocale/characterdirection(forlanguage:).md)
- [lineDirection(forLanguage:)](foundation/nslocale/linedirection(forlanguage:).md)
- [NSLocale.LanguageDirection](foundation/nslocale/languagedirection.md)

### Instance Properties

- [languageIdentifier](foundation/nslocale/languageidentifier.md)
- [regionCode](foundation/nslocale/regioncode.md)

## Relationships

### Inherits From

- [NSObject](objectivec/nsobject-swift.class.md)

### Conforms To

- [CVarArg](swift/cvararg.md)
- [Copyable](swift/copyable.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [Escapable](swift/escapable.md)
- [Hashable](swift/hashable.md)
- [NSCoding](foundation/nscoding.md)
- [NSCopying](foundation/nscopying.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)
- [NSSecureCoding](foundation/nssecurecoding.md)
- [Sendable](swift/sendable.md)
- [SendableMetatype](swift/sendablemetatype.md)

## See Also

### Related Documentation

- [Internationalization and Localization Guide](apple-archive/documentation/MacOSX/Conceptual/BPInternational/Introduction.md)
- [Data Formatting Guide](apple-archive/documentation/Cocoa/Conceptual/DataFormatting.md)
