Interface TranslationFallbackObserver

Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

Observes a translation supplied by a later locale candidate after earlier candidates failed.

The observer is called once, synchronously, after successful translation and before the lookup returns. It is not called when the first candidate succeeds, even if locale negotiation used fallback, or when the lookup fails. Unlike TranslationFallbackPolicy, it does not decide whether lookup continues, and unlike TranslationFailureHandler, it observes a successful outcome.

An observer exception propagates directly to the caller; it does not become a translation resolution failure or cause another locale attempt. Implementations shared by a Strings instance or TranslationOptions may be invoked concurrently and must be thread-safe.

Since:
3.1.1
Author:
Mark Allen
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    observe(@NonNull TranslationFallbackEvent translationFallbackEvent)
    Observes successful locale fallback.
  • Method Details

    • observe

      void observe(@NonNull TranslationFallbackEvent translationFallbackEvent)
      Observes successful locale fallback.
      Parameters:
      translationFallbackEvent - diagnostic event for this lookup, not null