Package org.hl7.fhir.utilities.i18n
Class I18nBase
- java.lang.Object
-
- org.hl7.fhir.utilities.i18n.I18nBase
-
-
Field Summary
Fields Modifier and Type Field Description static StringKEY_DELIMITERstatic StringPLURAL_SUFFIX
-
Constructor Summary
Constructors Constructor Description I18nBase()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringformatMessage(String theMessage, Object... theMessageArguments)Formats the given message, if needed, with the passed in message arguments.StringformatMessagePlural(Integer plural, String theMessage, Object... theMessageArguments)Formats the message with locale correct pluralization using the passed in message arguments.LocalegetLocale()protected StringgetPluralKey(Integer number, String baseKey)booleanisWarnAboutMissingMessages()voidsetLocale(Locale locale)voidsetPluralRules(Locale locale)voidsetValidationMessageLanguage(Locale locale)Loads the correspondingResourceBundlefor the passed inLocale.voidsetWarnAboutMissingMessages(boolean warnAboutMissingMessages)
-
-
-
Field Detail
-
PLURAL_SUFFIX
public static final String PLURAL_SUFFIX
- See Also:
- Constant Field Values
-
KEY_DELIMITER
public static final String KEY_DELIMITER
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
I18nBase
public I18nBase()
-
-
Method Detail
-
formatMessage
public String formatMessage(String theMessage, Object... theMessageArguments)
Formats the given message, if needed, with the passed in message arguments.- Parameters:
theMessage- Base message to format.theMessageArguments- Placeholder arguments, if needed.- Returns:
- The formatted, internationalized,
String
-
getPluralKey
protected String getPluralKey(Integer number, String baseKey)
-
formatMessagePlural
public String formatMessagePlural(Integer plural, String theMessage, Object... theMessageArguments)
Formats the message with locale correct pluralization using the passed in message arguments. In the message properties files, each plural specific message will have a key consisting of a root key and a suffix denoting the plurality rule (_one for singular, _other for multiple in English, for example). Suffixes are provided by th ICU4J library from unicode.org- Parameters:
plural- The number that indicates the plurality of the phrasetheMessage- the root key of the phrase.theMessageArguments- Placeholder arguments, if needed.- Returns:
- The formatted, internationalized,
String
-
setValidationMessageLanguage
public void setValidationMessageLanguage(Locale locale)
Loads the correspondingResourceBundlefor the passed inLocale.- Parameters:
locale-Localeto load resources for.
-
setPluralRules
public void setPluralRules(Locale locale)
-
isWarnAboutMissingMessages
public boolean isWarnAboutMissingMessages()
-
setWarnAboutMissingMessages
public void setWarnAboutMissingMessages(boolean warnAboutMissingMessages)
-
-