LocalizedText

struct LocalizedText
extension LocalizedText : AutomationValue, Decodable, Encodable, Equatable, Hashable, Sendable, SendableMetatype, StructDataRepresentable

Represents a localized string and its corresponding locale.

This struct maps to Google_Type_LocalizedText, defined here: google3/google/type/localized_text.proto.

  • The actual localized text.

    Declaration

    Swift

    let text: String
  • The BCP-47 locale (e.g. “en-US”).

    Declaration

    Swift

    let locale: Locale
  • Undocumented

    Declaration

    Swift

    init(text: String, locale: Locale)
  • Initializes LocalizedText with the trait decoder.

    Declaration

    Swift

    init(decoder: TraitDecoder) throws

    Parameters

    decoder

    The trait decoder to decode the localized text.

  • Encodes LocalizedText to the trait encoder.

    Declaration

    Swift

    func encode(with encoder: TraitEncoder) throws
  • Creates a new instance by decoding from the given decoder.

    This initializer throws an error if reading from the decoder fails, or if the data read is corrupted or otherwise invalid.

    Declaration

    Swift

    init(from decoder: any Decoder) throws