Package limn.i18n
Class LanguageWitness
java.lang.Object
limn.i18n.LanguageWitness
Whether the language moved since a derived string was last built: the two facts a memo of
formatted text has to compare,
I18n.epoch() and I18n.locale(), held as one.
A spinner's displayed value, a video view's clock, a colour picker's spoken description: each is a string built from a value and the language, and each is rebuilt only when one of the two moved, because building it inside a describe hook would allocate on every damaged frame. Three widgets kept the epoch and the locale as two fields and two comparisons apiece; this is the pair once, with the refresh folded into the question.
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
LanguageWitness
public LanguageWitness()
-
-
Method Details
-
moved
public boolean moved()Whether the language moved since the last call, and if it did, remembers where it is now. Asked first, before the memo's own keys, so that the answer is taken even when another key forces the rebuild anyway; otherwise the next frame would report a move that had already been built for.- Returns:
- whether the epoch or the locale differs from the last call; always true on the first
-
locale
- Returns:
- the locale the last built string was made under, or
nullbefore the first
-