• 文法的一致の活用法

    アプリやゲームで対象言語の文法の自動一致を利用して、インクルーシブでより自然な表現を作成する方法を紹介します。Foundationで作業するためのベストプラクティスや、複数の言語での事例を紹介し、アプリのユーザー体験を向上させるこれらのAPIの使用方法を実演します。文法の自動一致の概要については、WWDC21の「What's new in Foundation」をご覧ください。

    関連する章

    リソース

    関連ビデオ

    WWDC23

    WWDC22

    WWDC21

  • ダウンロード
    Array
    • 4:08 - agreeWithConcept

      // Formatting the string
      
      var options = AttributedString.LocalizationOptions()
      options.concepts = [.localizedPhrase(food.localizedName)]
      
      let size = AttributedString(localized: "small", options: options)
    • 8:45 - Preferred terms of address

      // A person who is delivering the food order
      
      struct DeliveryPerson {
      
          // The person's preferred name
          var name: String
      
          // An avatar for the delivery person
          var avatar: Image
      
          // The person's preferred terms of address. This list may contain more than
          // one option, we will use the first applicable one for the language that's
          // used in the UI.
          var preferredTermsOfAddress: [TermOfAddress]
      }
      
      // Formatting the message in Swift
      
      var options = AttributedString.LocalizationOptions()
      options.concepts = [.termsOfAddress(person.preferredTermsOfAddress)]
      
      let message = AttributedString(localized: 
"\(person.name) is on ^[their](referentConcept: 1) way.”, options: options)