Class I18nLocalizer
java.lang.Object
com.gufli.brick.i18n.common.localization.I18nLocalizer
- Direct Known Subclasses:
HytaleLocalizer, MinimessageLocalizer
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Localeprotected final Stringprotected final I18nRegistry -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal Stringid()final Stringfinal Stringfinal Stringfinal Stringlocalize(Locale locale, Duration duration, DurationFormatter formatter) This will replace the following time placeholders with their respective localization: Y - duration.year M - duration.month D - duration.day h - duration.hour m - duration.minute s - duration.secondfinal StringlocalizeOptional(Locale locale, String key) final StringlocalizeOptional(Locale locale, String key, Object... args) final StringrecursiveLocalize(Locale locale, String str) This method will replace any keys that are found with its localized value.<T> voidregisterConverter(Class<T> type, Function<T, Object> converter) final voidregisterLocale(URL resource) final voidregisterLocale(URL resource, Locale locale) final voidregisterLocale(Path path) protected voidregisterLocaleMessage(Locale locale, String key, MessageFormat messageFormat)
-
Field Details
-
registry
-
defaultLocale
-
id
-
-
Constructor Details
-
I18nLocalizer
-
-
Method Details
-
registerConverter
-
id
-
localize
-
localize
-
localizeOptional
-
localizeOptional
-
localize
This will replace the following time placeholders with their respective localization:- Y - duration.year
- M - duration.month
- D - duration.day
- h - duration.hour
- m - duration.minute
- s - duration.second
- Parameters:
locale- the locale to useduration- the duration to formatformatter- the formatter to use- Returns:
- the translated and formatted duration
-
localize
-
recursiveLocalize
This method will replace any keys that are found with its localized value. It will then return the resulting string. If no keys are found, this will return the given string exactly.- Parameters:
locale- the locale to use for localizationstr- the string to localize- Returns:
- the localized string
-
registerLocale
- Throws:
MalformedURLException
-
registerLocale
-
registerLocale
-
registerLocaleMessage
-