Contents

supportedLocale(equivalentTo:)

A locale from the module’s supported locales equivalent to the given locale.

Declaration

static func supportedLocale(equivalentTo locale: Locale) async -> Locale?

Parameters

  • locale:

    An arbitrary locale.

Return Value

A locale in the supported locales list, or nil if there is no equivalent locale in that list.

Discussion

Use this method to determine which of this module’s supported locales is equivalent to an arbitrary locale such as Locale.current. Use this method instead of supportedLocales.contains(_:); two locales may be equivalent but not equal, and contains(_:) uses equality rather than equivalence.

See Also

Getting supported locales