Class SpincastDictionaryDefault
- All Implemented Interfaces:
Dictionary
Dictionary
.
Provides a value for the core Spincast messages required by any application.
You have to override the addMessages()
method to
add your own messages.
-
Field Summary
-
Constructor Summary
ConstructorDescriptionSpincastDictionaryDefault
(LocaleResolver localeResolver, TemplatingEngine templatingEngine, SpincastConfig spincastConfig, Set<DictionaryEntries> dictionaryEntries) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
protected void
To override to add messages to the dictionary.Gets a message.Gets a message.Gets a message.Gets a message.Gets a message.Gets a message.Gets a message.final String
Gets a message.Return all the possible values, for all languages used, by language abreviation.Return all the possible values, for all languages used, by language abreviation.Return all the possible values, for all languages used, by language abreviation.protected Locale
protected Set<DictionaryEntries>
protected SpincastConfig
protected TemplatingEngine
boolean
Contains this key?protected String
Methods inherited from class org.spincast.core.dictionary.DictionaryBase
getAllKeys, getMessages, key, msg
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.spincast.core.dictionary.Dictionary
getAllKeys
-
Field Details
-
logger
protected static final org.slf4j.Logger logger
-
-
Constructor Details
-
SpincastDictionaryDefault
@Inject public SpincastDictionaryDefault(LocaleResolver localeResolver, TemplatingEngine templatingEngine, SpincastConfig spincastConfig, @Nullable Set<DictionaryEntries> dictionaryEntries)
-
-
Method Details
-
getDefaultLocale
-
getTemplatingEngine
-
getSpincastConfig
-
getDictionaryEntries
-
hasKey
Description copied from interface:Dictionary
Contains this key?- Specified by:
hasKey
in interfaceDictionary
-
get
Gets a message. Will use the proper Locale as provided by theLocaleResolver
.- Specified by:
get
in interfaceDictionary
-
get
Description copied from interface:Dictionary
Gets a message.Uses the specified Locale.
The behavior if the key is not found can be configured using
SpincastConfig#getDictionaryEntryNotFoundFallbackTo()
andSpincastConfig.getDictionaryEntryNotFoundBehavior()
.- Specified by:
get
in interfaceDictionary
-
get
Gets a message. Will use the proper Locale as provided by theLocaleResolver
.- Specified by:
get
in interfaceDictionary
forceTemplatingEngine
- iftrue
, theTemplatingEngine
will be used even there are no parameters. This may be useful to trigger some templating function that don't need parameters. We don't use the templting engine will default since it is costy.The behavior if the key is not found can be configured using
SpincastConfig#getDictionaryEntryNotFoundFallbackTo()
andSpincastConfig.getDictionaryEntryNotFoundBehavior()
.
-
get
Description copied from interface:Dictionary
Gets a message.Uses the specified Locale.
- Specified by:
get
in interfaceDictionary
forceEvaluation
- iftrue
, theTemplatingEngine
will be used even there are no parameters. This may be useful to trigger some templating function that don't need parameters. We don't use the templting engine will default since it is costy.The behavior if the key is not found can be configured using
SpincastConfig#getDictionaryEntryNotFoundFallbackTo()
andSpincastConfig.getDictionaryEntryNotFoundBehavior()
.
-
get
Gets a message. Will use the proper Locale as provided by theLocaleResolver
.- Specified by:
get
in interfaceDictionary
-
get
Description copied from interface:Dictionary
Gets a message.Uses the specified Locale.
The behavior if the key is not found can be configured using
SpincastConfig#getDictionaryEntryNotFoundFallbackTo()
andSpincastConfig.getDictionaryEntryNotFoundBehavior()
.- Specified by:
get
in interfaceDictionary
-
get
Gets a message. Will use the proper Locale as provided by theLocaleResolver
.- Specified by:
get
in interfaceDictionary
-
get
Description copied from interface:Dictionary
Gets a message.Uses the specified Locale.
The behavior if the key is not found can be configured using
SpincastConfig#getDictionaryEntryNotFoundFallbackTo()
andSpincastConfig.getDictionaryEntryNotFoundBehavior()
.- Specified by:
get
in interfaceDictionary
-
get
-
keyNotFound
-
addCoreAndPluginsMessages
protected void addCoreAndPluginsMessages() -
getAll
Description copied from interface:Dictionary
Return all the possible values, for all languages used, by language abreviation.- Specified by:
getAll
in interfaceDictionary
-
getAll
Description copied from interface:Dictionary
Return all the possible values, for all languages used, by language abreviation.- Specified by:
getAll
in interfaceDictionary
-
getAll
Description copied from interface:Dictionary
Return all the possible values, for all languages used, by language abreviation.- Specified by:
getAll
in interfaceDictionary
-
addMessages
protected void addMessages()To override to add messages to the dictionary.Example :
protected void addMessages() { super.addMessages(); key("my.message.key", msg("en", "The message in english"), msg("fr", "Le message en français")); }
-