region
The region of the language. Returns nil if it cannot be determined
- iOS
- 16+
- macOS
- 13+
- tvOS
- 16+
- watchOS
- 9+
var region: Locale.Region? { get }
The region of the language. Returns nil if it cannot be determined
var region: Locale.Region? { get }
s20FoundationEssentials6LocaleV8LanguageV0A20InternationalizationE6regionAC6RegionVSgvp
What are these?7N4EF
import FoundationEssentials
import FoundationInternationalization
struct Language
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.
struct Region
init(identifier: String)
Creates a Language
with the language identifier
var characterDirection: Locale.LanguageDirection { get }
Ordering of characters within a line. For example, left-to-right for English; top-to-bottom for Mongolian in the Mongolian Script
var languageCode: Locale.LanguageCode? { get }
The language code of the language. Returns nil if it cannot be determined
var lineLayoutDirection: Locale.LanguageDirection { get }
Ordering of lines within a page. For example, top-to-bottom for English; right-to-left for Mongolian in the Mongolian Script
var maximalIdentifier: String { get }
Returns a BCP-47 identifier that always includes the script: “zh-Hant-TW”, “en-Latn-US”
var minimalIdentifier: String { get }
Returns a BCP-47 identifier in a minimalist form. Script and region may be omitted. For example, “zh-TW”, “en”
var parent: Locale.Language? { get }
Returns the parent language of a language. For example, the parent language of "en_US_POSIX"
is "en_US"
Returns nil if the parent language cannot be determined
var script: Locale.Script? { get }
The script of the language. Returns nil if it cannot be determined
func hasCommonParent(with language: Locale.Language) -> Bool
func isEquivalent(to language: Locale.Language) -> Bool
Returns if self
and the specified language
are equal after expanding missing components For example, en
, en-Latn
, en-US
, and en-Latn-US
are equivalent