Interface Translator
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Strategy for translating a piece of text from one language to another, used
by
LocalizedField to fill in the language versions the user has not
typed in themselves.
The interface is intentionally independent of any particular translation
backend: implement it with an online translation service, a large language
model (e.g. via Spring AI), a dictionary, or anything else. Implementations
are allowed to block (do network I/O); LocalizedField invokes them
off the UI thread and applies the results via UI.access(...).
-
Method Summary
-
Method Details
-
translate
Translates the given text.- Parameters:
text- the text to translate, nevernullfrom- the language oftextto- the language to translate into- Returns:
- the translated text
-