1 package org.argeo.cms;
2
3 import java.text.MessageFormat;
4 import java.util.Locale;
5
6
7 public interface Localized {
8
9 default Object local(Locale locale) {
10 return LocaleUtils.local((Enum<?>) this, locale);
11 }
12
13 default String lead() {
14 return LocaleUtils.lead(this);
15 }
16
17 default String format(Object[] args) {
18 Locale locale = LocaleUtils.getCurrentLocale();
19 MessageFormat format = new MessageFormat(local(locale).toString(), locale);
20 return format.format(args);
21 }
22
23 default String lead(Locale locale) {
24 return LocaleUtils.lead(local(locale).toString(), locale);
25 }
26
27 }