Interface TranslationsController.SessionTranslation.Delegate

Enclosing class:

@AnyThread public static interface TranslationsController.SessionTranslation.Delegate
The translations session delegate is used for receiving translation events and information.
  • Method Details

    • onOfferTranslate

      default void onOfferTranslate(@NonNull GeckoSession session)
      onOfferTranslate occurs when a page should be offered for translation.

      An offer should occur when all conditions are met:

      * The page is not in the user's preferred language

      * The page language is eligible for translation

      * The host hasn't been offered for translation in this session

      * No user preferences indicate that translation shouldn't be offered

      * It is possible to translate

      Usual use-case is to show a pop-up recommending a translation.

      session - The associated GeckoSession.
    • onExpectedTranslate

      default void onExpectedTranslate(@NonNull GeckoSession session)
      onExpectedTranslate occurs when it is likely the user will want to translate and it is feasible. For example, if the page is in a different language than the user preferred language or languages.

      Usual use-case is to add a toolbar option for translate.

      session - The associated GeckoSession.
    • onTranslationStateChange

      default void onTranslationStateChange(@NonNull GeckoSession session, @Nullable TranslationsController.SessionTranslation.TranslationState translationState)
      onTranslationStateChange occurs when new information about the translation state is available. This includes information when first visiting the page and after calls to translate.
      session - The associated GeckoSession.
      translationState - The state of the translation as reported by the translation engine.