MLKitTranslate Framework Reference

  • MLKTranslateLanguage defines the languages supported by the Translator.

  • MLKTranslatorDownloadModelIfNeededCallback is a block called when translate model downloads finish, signaling success or error.

  • MLKTranslatorCallback is a block providing the translation result or error upon completion.

Type Definitions

The following type definitions are available globally.

  • This enum specifies the languages that are supported by Translator .

    Declaration

    Objective-C

      typedef 
     NSString 
     * 
     MLKTranslateLanguage 
     
    
  • A block that is invoked when the downloading of translate models is complete.

    Declaration

    Objective-C

      typedef 
     void 
     ( 
     ^ 
     MLKTranslatorDownloadModelIfNeededCallback 
     )( 
     NSError 
     * 
     _Nullable 
     ) 
     
    

    Parameters

    error

    The error or nil .

  • A block containing the translation result or nil if there’s an error.

    Declaration

    Objective-C

      typedef 
     void 
     ( 
     ^ 
     MLKTranslatorCallback 
     )( 
     NSString 
     * 
     _Nullable 
     , 
     NSError 
     * 
     _Nullable 
     ) 
     
    

    Parameters

    result

    A translation result for the text or nil if there’s an error.

    error

    The error or nil .

Create a Mobile Website
View Site in Mobile | Classic
Share by: