Class LanguageBackends

java.lang.Object
com.codename1.ai.language.LanguageBackends

public final class LanguageBackends extends Object

Selects native backends for language identification, translation, and Smart Reply. Automatic selection uses ML Kit on Android, Apple Natural Language for iOS identification. iOS translation and Smart Reply require their feature-specific ML Kit selector methods.

The feature-specific methods are also build-time dependency markers. They intentionally remain distinct even though they return the same runtime backend id, because the builder scans each call site to include only the requested ML Kit component.

  • Method Details

    • auto

      public static LanguageBackend auto()
      Returns:
      the platform-recommended dependency-minimal backend
    • appleNaturalLanguage

      public static LanguageBackend appleNaturalLanguage()
      Selects Apple's dependency-free Natural Language framework for language identification. This backend is available on iOS 12 and newer and is not available on Android.
      Returns:
      the Apple Natural Language backend selector
    • mlKitLanguageIdentification

      public static LanguageBackend mlKitLanguageIdentification()
      Selects ML Kit specifically for language identification. Calling this method lets the builder add the Language ID pod only when the application opts out of the Apple-native iOS default.
      Returns:
      the ML Kit language-identification selector
    • mlKitTranslation

      public static LanguageBackend mlKitTranslation()
      Selects ML Kit translation. Calling this method is the build-time marker that adds the translation pod on iOS; merely referencing Translator does not add it or disable the arm64 simulator.
      Returns:
      the ML Kit translation selector
    • mlKitSmartReply

      public static LanguageBackend mlKitSmartReply()
      Selects ML Kit Smart Reply. Calling this method is the build-time marker that adds the Smart Reply pod on iOS; merely referencing SmartReply does not add it or disable the arm64 simulator.
      Returns:
      the ML Kit Smart Reply selector