Region
- iOS
- 16+
- macOS
- 13+
- tvOS
- 16+
- watchOS
- 9+
struct Region
struct Region
import FoundationEssentials
struct Locale
Locale
encapsulates information about linguistic, cultural, and technological conventions and standards. Examples of information encapsulated by a locale include the symbol used for the decimal separator in numbers and the way dates are formatted.
init(components: Locale.Components)
Creates a Locale
with the specified locale components
init(from decoder: any Decoder) throws
init(identifier: String)
Return a locale with the specified identifier.
init(identifier: String, preferences: LocalePreferences?)
init(languageCode: Locale.LanguageCode? = nil, script: Locale.Script? = nil, languageRegion: Locale.Region? = nil)
init(languageComponents: Locale.Language.Components)
Creates a Locale
with the specified language components
static var autoupdatingCurrent: Locale { get }
Returns a locale which tracks the user’s current preferences.
static var current: Locale { get }
Returns the user’s current locale.
static var preferredLanguages: [String] { get }
Returns a list of the user’s preferred languages.
static func canonicalIdentifier(from string: String) -> String
Returns a canonical identifier from the given string.
static func canonicalLanguageIdentifier(from string: String) -> String
Returns a canonical language identifier from the given string.
static func identifier(fromComponents components: [String : String]) -> String
Constructs an identifier from a dictionary of components.
static func identifierDoesNotRequireSpecialCaseHandling(_ identifier: String) -> Bool
var alternateQuotationBeginDelimiter: String? { get }
Returns the alternate quotation begin delimiter of the locale.
var alternateQuotationEndDelimiter: String? { get }
Returns the alternate quotation end delimiter of the locale.
var availableNumberingSystems: [Locale.NumberingSystem] { get }
Returns all the valid numbering systems for the locale. For example, "ar-AE (Arabic (United Arab Emirates)"
has both "latn" (Latin digits)
and "arab" (Arabic-Indic digits)
numbering system.
var calendar: Calendar { get }
Returns the calendar for the locale, or the Gregorian calendar as a fallback.
var collation: Locale.Collation { get }
Returns the default collation used by the locale. Default is .standard
.
var collationIdentifier: String? { get }
Returns the collation identifier for the locale, or nil if it has none.
var collatorIdentifier: String? { get }
Returns the collator identifier of the locale.
var currency: Locale.Currency? { get }
Returns the currency of the locale. Returns nil if the data isn’t available.
var currencyCode: String? { get }
Returns the currency code of the locale.
var currencySymbol: String? { get }
Returns the currency symbol of the locale.
var customMirror: Mirror { get }
var debugDescription: String { get }
var decimalSeparator: String? { get }
Returns the decimal separator of the locale.
var description: String { get }
var firstDayOfWeek: Locale.Weekday { get }
Returns the first day of the week of the locale. Returns .sunday
as the default value if the data isn’t available to the requested locale.
var forceHourCycle: Locale.HourCycle? { get }
var forceMeasurementSystem: Locale.MeasurementSystem? { get }
var forceTemperatureUnit: LocalePreferences.TemperatureUnit? { get }
var groupingSeparator: String? { get }
Returns the grouping separator of the locale.
var hourCycle: Locale.HourCycle { get }
Returns the hour cycle such as whether it uses 12-hour clock or 24-hour clock. Default is .zeroToTwentyThree
if the data isn’t available. Calling this on .current
or .autoupdatingCurrent
returns user’s preference values as set in the system settings if available, overriding the default value of the user’s locale.
var identifier: String { get }
Returns the identifier of the locale.
var identifierCapturingPreferences: String { get }
var language: Locale.Language { get }
var languageCode: String? { get }
Returns the language code of the locale, or nil if has none.
var measurementSystem: Locale.MeasurementSystem { get }
var numberingSystem: Locale.NumberingSystem { get }
Returns the numbering system of the locale. If the locale has an explicitly specified numbering system in the identifier (e.g. bn_BD@numbers=latn
) or in the associated Locale.Components
, that numbering system is returned. Otherwise, returns the default numbering system of the locale. Returns "latn"
as the default value if the data isn’t available.
var prefs: LocalePreferences? { get }
var quotationBeginDelimiter: String? { get }
Returns the quotation begin delimiter of the locale.
var quotationEndDelimiter: String? { get }
Returns the quotation end delimiter of the locale.
var region: Locale.Region? { get }
Returns the region of the locale. For example, “US” for “en_US”, “GB” for “en_GB”, “PT” for “pt_PT”.
var regionCode: String? { get }
Returns the region code of the locale, or nil if it has none.
var scriptCode: String? { get }
Returns the script code of the locale, or nil if has none.
var subdivision: Locale.Subdivision? { get }
Returns the regional subdivision for the locale, or nil if there is none.
var temperatureUnit: LocalePreferences.TemperatureUnit { get }
var timeZone: TimeZone? { get }
var usesMetricSystem: Bool { get }
Returns true if the locale uses the metric system.
var variant: Locale.Variant? { get }
Returns the variant for the locale, or nil if it has none. For example, for the locale “en_POSIX”, returns “POSIX”.
var variantCode: String? { get }
Returns the variant code for the locale, or nil if it has none.
static func == (lhs: Locale, rhs: Locale) -> Bool
func encode(to encoder: any Encoder) throws
func forceFirstWeekday(_ calendar: Calendar.Identifier) -> Locale.Weekday?
func forceMinDaysInFirstWeek(_ calendar: Calendar.Identifier) -> Int?
func hash(into hasher: inout Hasher)
func identifier(_ type: Locale.IdentifierType) -> String
func localizedString(for calendarIdentifier: Calendar.Identifier) -> String?
Returns a localized string for a specified Calendar.Identifier
.
func localizedString(forCollationIdentifier collationIdentifier: String) -> String?
Returns a localized string for a specified ICU collation identifier.
func localizedString(forCollatorIdentifier collatorIdentifier: String) -> String?
Returns a localized string for a specified ICU collator identifier.
func localizedString(forCurrencyCode currencyCode: String) -> String?
Returns a localized string for a specified ISO 4217 currency code.
func localizedString(forIdentifier identifier: String) -> String?
Returns a localized string for a specified identifier.
func localizedString(forLanguageCode languageCode: String) -> String?
Returns a localized string for a specified language code.
func localizedString(forRegionCode regionCode: String) -> String?
Returns a localized string for a specified region code.
func localizedString(forScriptCode scriptCode: String) -> String?
Returns a localized string for a specified script code.
func localizedString(forVariantCode variantCode: String) -> String?
Returns a localized string for a specified variant code.
struct Collation
struct Components
Represents locale-related attributes. You can use Locale.Components
to create a Locale
with specific overrides.
struct Currency
enum HourCycle
enum IdentifierType
struct Language
struct LanguageCode
enum LanguageDirection
struct MeasurementSystem
struct NumberingSystem
struct Script
struct Subdivision
struct Variant
enum Weekday
protocol Copyable
A type whose values can be implicitly or explicitly copied.
protocol CustomDebugStringConvertible
A type with a customized textual representation suitable for debugging purposes.
protocol Decodable
A type that can decode itself from an external representation.
protocol Encodable
A type that can encode itself to an external representation.
protocol Equatable
A type that can be compared for value equality.
protocol Escapable
protocol ExpressibleByExtendedGraphemeClusterLiteral : ExpressibleByUnicodeScalarLiteral
A type that can be initialized with a string literal containing a single extended grapheme cluster.
protocol ExpressibleByStringLiteral : ExpressibleByExtendedGraphemeClusterLiteral
A type that can be initialized with a string literal.
protocol ExpressibleByUnicodeScalarLiteral
A type that can be initialized with a string literal containing a single Unicode scalar value.
protocol Hashable : Equatable
A type that can be hashed into a Hasher
to produce an integer hash value.
protocol Sendable
init(_ identifier: String)
Creates a Region
with the specified region code
init(from decoder: any Decoder) throws
init(stringLiteral value: String)
static var afghanistan: Locale.Region { get }
static var albania: Locale.Region { get }
static var algeria: Locale.Region { get }
static var americanSamoa: Locale.Region { get }
static var andorra: Locale.Region { get }
static var angola: Locale.Region { get }
static var anguilla: Locale.Region { get }
static var antarctica: Locale.Region { get }
static var antiguaBarbuda: Locale.Region { get }
static var argentina: Locale.Region { get }
static var armenia: Locale.Region { get }
static var aruba: Locale.Region { get }
static var ascensionIsland: Locale.Region { get }
static var australia: Locale.Region { get }
static var austria: Locale.Region { get }
static var azerbaijan: Locale.Region { get }
static var bahamas: Locale.Region { get }
static var bahrain: Locale.Region { get }
static var bangladesh: Locale.Region { get }
static var barbados: Locale.Region { get }
static var belarus: Locale.Region { get }
static var belgium: Locale.Region { get }
static var belize: Locale.Region { get }
static var benin: Locale.Region { get }
static var bermuda: Locale.Region { get }
static var bhutan: Locale.Region { get }
static var bolivia: Locale.Region { get }
static var bosniaHerzegovina: Locale.Region { get }
static var botswana: Locale.Region { get }
static var bouvetIsland: Locale.Region { get }
static var brazil: Locale.Region { get }
static var britishVirginIslands: Locale.Region { get }
static var brunei: Locale.Region { get }
static var bulgaria: Locale.Region { get }
static var burkinaFaso: Locale.Region { get }
static var burundi: Locale.Region { get }
static var cambodia: Locale.Region { get }
static var cameroon: Locale.Region { get }
static var canada: Locale.Region { get }
static var canaryIslands: Locale.Region { get }
static var capeVerde: Locale.Region { get }
static var caribbeanNetherlands: Locale.Region { get }
static var caymanIslands: Locale.Region { get }
static var centralAfricanRepublic: Locale.Region { get }
static var ceutaMelilla: Locale.Region { get }
static var chad: Locale.Region { get }
static var chagosArchipelago: Locale.Region { get }
static var chile: Locale.Region { get }
static var chinaMainland: Locale.Region { get }
static var christmasIsland: Locale.Region { get }
static let cldrKeywordKey: ICUCLDRKey
static var clippertonIsland: Locale.Region { get }
static var cocosIslands: Locale.Region { get }
static var colombia: Locale.Region { get }
static var comoros: Locale.Region { get }
static var congoBrazzaville: Locale.Region { get }
static var congoKinshasa: Locale.Region { get }
static var cookIslands: Locale.Region { get }
static var costaRica: Locale.Region { get }
static var croatia: Locale.Region { get }
static var cuba: Locale.Region { get }
static var curaçao: Locale.Region { get }
static var cyprus: Locale.Region { get }
static var czechia: Locale.Region { get }
static var côteDIvoire: Locale.Region { get }
static var denmark: Locale.Region { get }
static var diegoGarcia: Locale.Region { get }
static var djibouti: Locale.Region { get }
static var dominica: Locale.Region { get }
static var dominicanRepublic: Locale.Region { get }
static var ecuador: Locale.Region { get }
static var egypt: Locale.Region { get }
static var elSalvador: Locale.Region { get }
static var equatorialGuinea: Locale.Region { get }
static var eritrea: Locale.Region { get }
static var estonia: Locale.Region { get }
static var eswatini: Locale.Region { get }
static var ethiopia: Locale.Region { get }
static var falklandIslands: Locale.Region { get }
static var faroeIslands: Locale.Region { get }
static var fiji: Locale.Region { get }
static var finland: Locale.Region { get }
static var france: Locale.Region { get }
static var frenchGuiana: Locale.Region { get }
static var frenchPolynesia: Locale.Region { get }
static var frenchSouthernTerritories: Locale.Region { get }
static var gabon: Locale.Region { get }
static var gambia: Locale.Region { get }
static var georgia: Locale.Region { get }
static var germany: Locale.Region { get }
static var ghana: Locale.Region { get }
static var gibraltar: Locale.Region { get }
static var greece: Locale.Region { get }
static var greenland: Locale.Region { get }
static var grenada: Locale.Region { get }
static var guadeloupe: Locale.Region { get }
static var guam: Locale.Region { get }
static var guatemala: Locale.Region { get }
static var guernsey: Locale.Region { get }
static var guinea: Locale.Region { get }
static var guineaBissau: Locale.Region { get }
static var guyana: Locale.Region { get }
static var haiti: Locale.Region { get }
static var heardMcdonaldIslands: Locale.Region { get }
static var honduras: Locale.Region { get }
static var hongKong: Locale.Region { get }
static var hungary: Locale.Region { get }
static var iceland: Locale.Region { get }
static var india: Locale.Region { get }
static var indonesia: Locale.Region { get }
static var iran: Locale.Region { get }
static var iraq: Locale.Region { get }
static var ireland: Locale.Region { get }
static var isleOfMan: Locale.Region { get }
static var israel: Locale.Region { get }
static var italy: Locale.Region { get }
static var jamaica: Locale.Region { get }
static var japan: Locale.Region { get }
static var jersey: Locale.Region { get }
static var jordan: Locale.Region { get }
static var kazakhstan: Locale.Region { get }
static var kenya: Locale.Region { get }
static var kiribati: Locale.Region { get }
static var kosovo: Locale.Region { get }
static var kuwait: Locale.Region { get }
static var kyrgyzstan: Locale.Region { get }
static var laos: Locale.Region { get }
static var latinAmerica: Locale.Region { get }
static var latvia: Locale.Region { get }
static var lebanon: Locale.Region { get }
static let legacyKeywordKey: ICULegacyKey
static var lesotho: Locale.Region { get }
static var liberia: Locale.Region { get }
static var libya: Locale.Region { get }
static var liechtenstein: Locale.Region { get }
static var lithuania: Locale.Region { get }
static var luxembourg: Locale.Region { get }
static var macao: Locale.Region { get }
static var madagascar: Locale.Region { get }
static var malawi: Locale.Region { get }
static var malaysia: Locale.Region { get }
static var maldives: Locale.Region { get }
static var mali: Locale.Region { get }
static var malta: Locale.Region { get }
static var marshallIslands: Locale.Region { get }
static var martinique: Locale.Region { get }
static var mauritania: Locale.Region { get }
static var mauritius: Locale.Region { get }
static var mayotte: Locale.Region { get }
static var mexico: Locale.Region { get }
static var micronesia: Locale.Region { get }
static var moldova: Locale.Region { get }
static var monaco: Locale.Region { get }
static var mongolia: Locale.Region { get }
static var montenegro: Locale.Region { get }
static var montserrat: Locale.Region { get }
static var morocco: Locale.Region { get }
static var mozambique: Locale.Region { get }
static var myanmar: Locale.Region { get }
static var namibia: Locale.Region { get }
static var nauru: Locale.Region { get }
static var nepal: Locale.Region { get }
static var netherlands: Locale.Region { get }
static var newCaledonia: Locale.Region { get }
static var newZealand: Locale.Region { get }
static var nicaragua: Locale.Region { get }
static var niger: Locale.Region { get }
static var nigeria: Locale.Region { get }
static var niue: Locale.Region { get }
static var norfolkIsland: Locale.Region { get }
static var northMacedonia: Locale.Region { get }
static var northernMarianaIslands: Locale.Region { get }
static var norway: Locale.Region { get }
static var oman: Locale.Region { get }
static var pakistan: Locale.Region { get }
static var palau: Locale.Region { get }
static var palestinianTerritories: Locale.Region { get }
static var panama: Locale.Region { get }
static var papuaNewGuinea: Locale.Region { get }
static var paraguay: Locale.Region { get }
static var peru: Locale.Region { get }
static var philippines: Locale.Region { get }
static var pitcairnIslands: Locale.Region { get }
static var poland: Locale.Region { get }
static var portugal: Locale.Region { get }
static var puertoRico: Locale.Region { get }
static var qatar: Locale.Region { get }
static var romania: Locale.Region { get }
static var russia: Locale.Region { get }
static var rwanda: Locale.Region { get }
static var réunion: Locale.Region { get }
static var saintBarthélemy: Locale.Region { get }
static var saintHelena: Locale.Region { get }
static var saintKittsNevis: Locale.Region { get }
static var saintLucia: Locale.Region { get }
static var saintMartin: Locale.Region { get }
static var saintPierreMiquelon: Locale.Region { get }
static var saintVincentGrenadines: Locale.Region { get }
static var samoa: Locale.Region { get }
static var sanMarino: Locale.Region { get }
static var saudiArabia: Locale.Region { get }
static var senegal: Locale.Region { get }
static var serbia: Locale.Region { get }
static var seychelles: Locale.Region { get }
static var sierraLeone: Locale.Region { get }
static var singapore: Locale.Region { get }
static var sintMaarten: Locale.Region { get }
static var slovakia: Locale.Region { get }
static var slovenia: Locale.Region { get }
static var solomonIslands: Locale.Region { get }
static var somalia: Locale.Region { get }
static var southAfrica: Locale.Region { get }
static var southGeorgiaSouthSandwichIslands: Locale.Region { get }
static var southKorea: Locale.Region { get }
static var southSudan: Locale.Region { get }
static var spain: Locale.Region { get }
static var sriLanka: Locale.Region { get }
static var suriname: Locale.Region { get }
static var svalbardJanMayen: Locale.Region { get }
static var sweden: Locale.Region { get }
static var switzerland: Locale.Region { get }
static var sãoToméPríncipe: Locale.Region { get }
static var taiwan: Locale.Region { get }
static var tajikistan: Locale.Region { get }
static var tanzania: Locale.Region { get }
static var thailand: Locale.Region { get }
static var timorLeste: Locale.Region { get }
static var togo: Locale.Region { get }
static var tokelau: Locale.Region { get }
static var tonga: Locale.Region { get }
static var trinidadTobago: Locale.Region { get }
static var tristanDaCunha: Locale.Region { get }
static var tunisia: Locale.Region { get }
static var turkey: Locale.Region { get }
static var turkmenistan: Locale.Region { get }
static var turksCaicosIslands: Locale.Region { get }
static var tuvalu: Locale.Region { get }
static var uganda: Locale.Region { get }
static var ukraine: Locale.Region { get }
static var unitedArabEmirates: Locale.Region { get }
static var unitedKingdom: Locale.Region { get }
static var unitedStates: Locale.Region { get }
static var unitedStatesOutlyingIslands: Locale.Region { get }
static var unitedStatesVirginIslands: Locale.Region { get }
static let unknown: Locale.Region
Represents an unknown or invalid region
static var uruguay: Locale.Region { get }
static var uzbekistan: Locale.Region { get }
static var vanuatu: Locale.Region { get }
static var vaticanCity: Locale.Region { get }
static var venezuela: Locale.Region { get }
static var vietnam: Locale.Region { get }
static var wallisFutuna: Locale.Region { get }
static var westernSahara: Locale.Region { get }
static var world: Locale.Region { get }
static var yemen: Locale.Region { get }
static var zambia: Locale.Region { get }
static var zimbabwe: Locale.Region { get }
static var ålandIslands: Locale.Region { get }
var debugDescription: String { get }
var identifier: String { get set }
static func == (lhs: Locale.Region, rhs: Locale.Region) -> Bool
func encode(to encoder: any Encoder) throws
func hash(into hasher: inout Hasher)
init(extendedGraphemeClusterLiteral value: Self.StringLiteralType)
init(unicodeScalarLiteral value: Self.ExtendedGraphemeClusterLiteralType)
static func != (lhs: Self, rhs: Self) -> Bool
Returns a Boolean value indicating whether two values are not equal.
import FoundationInternationalization
static var isoRegions: [Locale.Region] { get }
Returns a list of regions of a specified type defined by ISO
var containingRegion: Locale.Region? { get }
Returns the region within which the region is contained, e.g. for US
, returns Northern America
var continent: Locale.Region? { get }
Returns the continent of the region. Returns nil
if the continent cannot be determined, such as when the region isn’t an ISO region
var isISORegion: Bool { get }
var subRegions: [Locale.Region] { get }
Returns all the sub-regions of the region