Package yakworks.i18n.icu
Class ICUBundleMessageSource
- java.lang.Object
-
- org.springframework.context.support.MessageSourceSupport
-
- org.springframework.context.support.AbstractMessageSource
-
- org.springframework.context.support.AbstractResourceBasedMessageSource
-
- org.springframework.context.support.ReloadableResourceBundleMessageSource
-
- yakworks.i18n.icu.ICUBundleMessageSource
-
- All Implemented Interfaces:
org.springframework.beans.factory.Aware,org.springframework.context.HierarchicalMessageSource,org.springframework.context.MessageSource,org.springframework.context.ResourceLoaderAware
public class ICUBundleMessageSource extends org.springframework.context.support.ReloadableResourceBundleMessageSourceICU4j Overrides, Lots of copy/paste horseplay as so much in ReloadableResourceBundleMessageSource is private and final. Also instead of supporting XML like it does, we support YAMl instead. The core issue here is that we need to return com.ibm.icu.text.MessageFormat and not java.text.MessageFormat. TODO: Need to confirm what wins if defined in both places.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classICUBundleMessageSource.PropertiesHolderOverride
-
Constructor Summary
Constructors Constructor Description ICUBundleMessageSource()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.util.List<java.lang.String>calculateAllFilenames(java.lang.String basename, java.util.Locale locale)voidclearCache()protected java.text.MessageFormatcreateMessageFormat(java.lang.String msg, java.util.Locale locale)protected com.ibm.icu.text.MessageFormatcreateMessageFormatICU(java.lang.String msg, java.util.Locale locale)protected ICUBundleMessageSource.PropertiesHoldergetMergedProperties(java.util.Locale locale)protected ICUBundleMessageSource.PropertiesHoldergetProperties(java.lang.String filename)protected java.util.PropertiesloadProperties(org.springframework.core.io.Resource resource, java.lang.String filename)protected longmergeExternalProperties(java.util.Locale locale, java.util.Properties mergedProps)protected voidmergePluginProperties(java.util.Locale locale, java.util.Properties mergedProps)ICUBundleMessageSource.PropertiesHolderrefreshPropertiesICU(java.lang.String filename, ICUBundleMessageSource.PropertiesHolder propHolder)protected java.text.MessageFormatresolveCode(java.lang.String code, java.util.Locale locale)protected com.ibm.icu.text.MessageFormatresolveCodeICU(java.lang.String code, java.util.Locale locale)Resolves the given message code as key in the retrieved bundle files, using a cached MessageFormat instance per message code.-
Methods inherited from class org.springframework.context.support.ReloadableResourceBundleMessageSource
calculateFilenamesForLocale, clearCacheIncludingAncestors, newProperties, refreshProperties, resolveCodeWithoutArguments, setConcurrentRefresh, setFileEncodings, setPropertiesPersister, setResourceLoader, toString
-
Methods inherited from class org.springframework.context.support.AbstractResourceBasedMessageSource
addBasenames, getBasenameSet, getCacheMillis, getDefaultEncoding, getDefaultLocale, isFallbackToSystemLocale, setBasename, setBasenames, setCacheMillis, setCacheSeconds, setDefaultEncoding, setDefaultLocale, setFallbackToSystemLocale
-
Methods inherited from class org.springframework.context.support.AbstractMessageSource
getCommonMessages, getDefaultMessage, getDefaultMessage, getMessage, getMessage, getMessage, getMessageFromParent, getMessageInternal, getParentMessageSource, isUseCodeAsDefaultMessage, resolveArguments, setCommonMessages, setParentMessageSource, setUseCodeAsDefaultMessage
-
-
-
-
Method Detail
-
resolveCode
@Nullable protected java.text.MessageFormat resolveCode(java.lang.String code, java.util.Locale locale)- Overrides:
resolveCodein classorg.springframework.context.support.ReloadableResourceBundleMessageSource
-
resolveCodeICU
@Nullable protected com.ibm.icu.text.MessageFormat resolveCodeICU(java.lang.String code, java.util.Locale locale)Resolves the given message code as key in the retrieved bundle files, using a cached MessageFormat instance per message code.
-
mergePluginProperties
protected void mergePluginProperties(java.util.Locale locale, java.util.Properties mergedProps)
-
mergeExternalProperties
protected long mergeExternalProperties(java.util.Locale locale, java.util.Properties mergedProps)
-
calculateAllFilenames
protected java.util.List<java.lang.String> calculateAllFilenames(java.lang.String basename, java.util.Locale locale)- Overrides:
calculateAllFilenamesin classorg.springframework.context.support.ReloadableResourceBundleMessageSource
-
getMergedProperties
protected ICUBundleMessageSource.PropertiesHolder getMergedProperties(java.util.Locale locale)
- Overrides:
getMergedPropertiesin classorg.springframework.context.support.ReloadableResourceBundleMessageSource
-
getProperties
protected ICUBundleMessageSource.PropertiesHolder getProperties(java.lang.String filename)
- Overrides:
getPropertiesin classorg.springframework.context.support.ReloadableResourceBundleMessageSource
-
refreshPropertiesICU
public ICUBundleMessageSource.PropertiesHolder refreshPropertiesICU(java.lang.String filename, @Nullable ICUBundleMessageSource.PropertiesHolder propHolder)
-
loadProperties
protected java.util.Properties loadProperties(org.springframework.core.io.Resource resource, java.lang.String filename) throws java.io.IOException- Overrides:
loadPropertiesin classorg.springframework.context.support.ReloadableResourceBundleMessageSource- Throws:
java.io.IOException
-
clearCache
public void clearCache()
- Overrides:
clearCachein classorg.springframework.context.support.ReloadableResourceBundleMessageSource
-
createMessageFormatICU
protected com.ibm.icu.text.MessageFormat createMessageFormatICU(java.lang.String msg, java.util.Locale locale)
-
createMessageFormat
protected java.text.MessageFormat createMessageFormat(java.lang.String msg, java.util.Locale locale)- Overrides:
createMessageFormatin classorg.springframework.context.support.MessageSourceSupport
-
-