Interface Locales
public interface Locales
The display locale, which the application may change while it runs. A singleton.
The locale starts as the choice saved by an earlier run, else the launch's DisplayLocale. A change
switches the Resources to the new locale, refreshes the open windows with the UI module, then changes
current(), and saves the choice to locale.toml in the application's config directory.
-
Method Summary
Modifier and TypeMethodDescriptioncurrent()Returns the display locale.<M> MReturns an implementation of a@Messagesinterface that reads the files of a locale, whatever the display locale.voidreset()Changes the display locale back to the launch'sDisplayLocale, asset(Locale)does, and deletes the saved choice.voidChanges the display locale, and saves the choice.
-
Method Details
-
current
-
set
Changes the display locale, and saves the choice. It may be called from any thread, and hands the change to theUiExecutor. A locale equal to the current one changes nothing.- Parameters:
locale- the new locale- Throws:
NullPointerException- iflocaleisnull
-
reset
void reset()Changes the display locale back to the launch'sDisplayLocale, asset(Locale)does, and deletes the saved choice. -
messages
Returns an implementation of a@Messagesinterface that reads the files of a locale, whatever the display locale. It is cached per type and locale.- Type Parameters:
M- the type of the messages- Parameters:
type- the@Messagesinterfacelocale- the locale of the messages- Returns:
- the messages in that locale
- Throws:
NullPointerException- if an argument isnullIllegalArgumentException- iftypeis not a@Messagesinterface compiled by swing's processor
-