Package org.hl7.fhir.utilities.i18n
Class I18nBase
java.lang.Object
org.hl7.fhir.utilities.i18n.I18nBase
- Direct Known Subclasses:
RenderingI18nContext
Handles the locale, ResourceBundle and String formatting for i18n
This abstract class should be extended when implementing a IWorkerContext Interface.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionformatMessage(String theMessage, Object... theMessageArguments) Formats the given message, if needed, with the passed in message arguments.formatMessagePlural(Integer plural, String theMessage, Object... theMessageArguments) Formats the message with locale correct pluralization using the passed in message arguments.protected ResourceBundleprotected Stringprotected StringgetPluralKey(Integer number, String baseKey) getPluralKeys(String baseKey) protected com.ibm.icu.text.PluralRulesprotected StringgetRootKeyFromPlural(String pluralKey) booleanprotected voidlogUncontainedMessage(String message) protected booleanmessageKeyExistsForLocale(String message) voidvoidsetValidationMessageLanguage(Locale locale) Deprecated.voidsetWarnAboutMissingMessages(boolean warnAboutMissingMessages) protected String
-
Field Details
-
KEY_DELIMITER
- See Also:
-
uncontainedKeys
-
-
Constructor Details
-
I18nBase
public I18nBase()
-
-
Method Details
-
getLocale
-
setLocale
-
getMessages
-
getPluralRules
-
logUncontainedMessage
-
typeOfString
-
messageKeyExistsForLocale
-
formatMessage
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
-
getPluralKeys
-
getPluralSuffixes
-
getRootKeyFromPlural
-
formatMessagePlural
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
Deprecated.Loads the correspondingResourceBundlefor the passed inLocale.- Parameters:
locale-Localeto load resources for.
-
getMessagesSourceFileName
-
isWarnAboutMissingMessages
-
setWarnAboutMissingMessages
-