LocalizedTexts

public struct LocalizedTexts : Hashable

The list of multiple names or titles for the same entity, possibly in different languages.

  • The list of text items. Recommended to use helper methods instead of directly accessing the items.

    Declaration

    Swift

    public var items: [LocalizedText]
  • Creates a new instance.

    Declaration

    Swift

    public init(items: [LocalizedText] = [])
  • Returns best name or title to be presented to the user according to specified locales. The locales are expected to be ordered by priority. If no matching locale found - the default is returned. In case of empty list returns nil.

    Declaration

    Swift

    public func preferredValue(for locales: [Locale]) -> String?

    Parameters

    locales

    Locales that will be used to translate name or title.

    Return Value

    Returns best name or title to be presented to the user according to specified locales.

  • Returns the default value. In case of empty list return nil.

    Declaration

    Swift

    public func defaultValue() -> String?

    Return Value

    Returns the default value.