<!--
{
  "availability" : [
    "iOS: 16.0.0 -",
    "iPadOS: 16.0.0 -",
    "macCatalyst: 16.0.0 -",
    "macOS: 13.0.0 -",
    "tvOS: 16.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 9.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/Locale/Components",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "s:10Foundation6LocaleV10ComponentsV"
  },
  "title" : "Locale.Components"
}
-->

# Locale.Components

A type that represents the components of a locale, for use when creating a locale with specific overrides.

```
struct Components
```

## Overview

Use [`Locale.Components`](/documentation/Foundation/Locale/Components) with the [`init(components:)`](/documentation/Foundation/Locale/init(components:)) initializer to create a custom [`Locale`](/documentation/Foundation/Locale) that overrides specific traits of a default locale. When you create a locale with components, the locale uses any overridden values instead of defaults preferred by the region or language. Leave a property `nil` to accept the default value.

The properties in this type correspond with those in [`Locale`](/documentation/Foundation/Locale), which declares them as read-only rather than read-write. You use this type to customize components when creating a custom locale, and use [`Locale`](/documentation/Foundation/Locale) to examine the components of an existing locale.

The following example creates a [`Locale.Components`](/documentation/Foundation/Locale/Components) instance for US English, but then customizes its components. It sets the first day of the week to Monday and the hour cycle to zero-to-23. These components override the `en-US` defaults of Sunday and one-to-12, respectively. It then uses [`init(components:)`](/documentation/Foundation/Locale/init(components:)) to create a custom [`Locale`](/documentation/Foundation/Locale).

```swift
var components = Locale.Components(languageCode: "en", languageRegion: "US")
components.firstDayOfWeek = Locale.Weekday.monday
components.hourCycle = Locale.HourCycle.zeroToTwentyThree
let locale = Locale(components: components)
```

## Topics

### Creating a locale components instance

[`init(identifier: String)`](/documentation/Foundation/Locale/Components/init(identifier:))

Creates a locale components instance with the specified identifier.

[`init(languageCode: Locale.LanguageCode?, script: Locale.Script?, languageRegion: Locale.Region?)`](/documentation/Foundation/Locale/Components/init(languageCode:script:languageRegion:))

Creates a locale components instance with the specified language code, script, and region identifier.

[`init(locale: Locale)`](/documentation/Foundation/Locale/Components/init(locale:))

Creates a language components instance from an existing locale.

### Specifying language components

[`var languageComponents: Locale.Language.Components`](/documentation/Foundation/Locale/Components/languageComponents)

The Unicode language identifier part of a locale.

[`struct Components`](/documentation/Foundation/Locale/Language-swift.struct/Components)

A type that identifies a language by its various components.

### Specifying date and time components

[`var calendar: Calendar.Identifier?`](/documentation/Foundation/Locale/Components/calendar)

The calendar used by the locale.

[`enum Identifier`](/documentation/Foundation/Calendar/Identifier-swift.enum)

An enumeration for the available calendars.

[`var firstDayOfWeek: Locale.Weekday?`](/documentation/Foundation/Locale/Components/firstDayOfWeek)

The first day of the week as represented by this locale.

[`enum Weekday`](/documentation/Foundation/Locale/Weekday)

A type that represents weekdays, used for indicating a locale’s first day of the week.

[`var hourCycle: Locale.HourCycle?`](/documentation/Foundation/Locale/Components/hourCycle)

The hour cycle used by the locale, like one-to-twelve or zero-to-twenty-three.

[`enum HourCycle`](/documentation/Foundation/Locale/HourCycle-swift.enum)

A type that represents the hour cycle used in a locale, like one-to-twelve or zero-to-twenty-three.

[`var timeZone: TimeZone?`](/documentation/Foundation/Locale/Components/timeZone)

The time zone used by the locale.

### Specifiying measurement and counting components

[`var currency: Locale.Currency?`](/documentation/Foundation/Locale/Components/currency)

The currency used by the locale.

[`struct Currency`](/documentation/Foundation/Locale/Currency-swift.struct)

A type that represents the currency system used by a locale, like dollars or euros.

[`var measurementSystem: Locale.MeasurementSystem?`](/documentation/Foundation/Locale/Components/measurementSystem)

The measurement system used by the locale, like metric or the US system.

[`struct MeasurementSystem`](/documentation/Foundation/Locale/MeasurementSystem-swift.struct)

A type that represents the measurement system used by a locale, like metric or the US system.

[`var numberingSystem: Locale.NumberingSystem?`](/documentation/Foundation/Locale/Components/numberingSystem)

The numbering system used by the locale.

[`struct NumberingSystem`](/documentation/Foundation/Locale/NumberingSystem-swift.struct)

A type that represents the numbering system used in a locale.

### Specifying region components

[`var region: Locale.Region?`](/documentation/Foundation/Locale/Components/region)

The region used by the locale.

[`struct Region`](/documentation/Foundation/Locale/Region-swift.struct)

A type that represents a geographic region, for use in specifying a locale or language.

[`var subdivision: Locale.Subdivision?`](/documentation/Foundation/Locale/Components/subdivision)

The optional subdivision of the region used by this locale.

[`struct Subdivision`](/documentation/Foundation/Locale/Subdivision-swift.struct)

A type that represents a subdivision of a region, such as a state in the US or a province in Canada.

[`var variant: Locale.Variant?`](/documentation/Foundation/Locale/Components/variant)

An optional variant used by the locale.

[`struct Variant`](/documentation/Foundation/Locale/Variant-swift.struct)

A type that represents a locale’s language variant.

### Specifying ordering components

[`var collation: Locale.Collation?`](/documentation/Foundation/Locale/Components/collation)

The string sort order of the locale.

[`struct Collation`](/documentation/Foundation/Locale/Collation-swift.struct)

A type that represents the string sort order used by the locale.

## Relationships

### Conforms To

[`Sendable`](/documentation/Swift/Sendable)

[`Encodable`](/documentation/Swift/Encodable)

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

[`Decodable`](/documentation/Swift/Decodable)

[`Equatable`](/documentation/Swift/Equatable)

[`Hashable`](/documentation/Swift/Hashable)

---

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)