package ch.gtache.fro; import java.util.Locale; import java.util.Map; /** * Represents a translated object */ @FunctionalInterface public interface Translated { /** * Returns the translations * * @return The translations */ Map translations(); /** * Translates the object using the given locale * * @param locale The locale * @return The translated string */ default String translate(final Locale locale) { return translations().get(locale); } /** * Translates the object using the default locale * * @return The translated string */ default String translate() { return translate(Locale.getDefault()); } }