Class SpincastDictionaryDefault

java.lang.Object
org.spincast.core.dictionary.DictionaryBase
org.spincast.plugins.dictionary.SpincastDictionaryDefault
All Implemented Interfaces:
org.spincast.core.dictionary.Dictionary

public class SpincastDictionaryDefault extends org.spincast.core.dictionary.DictionaryBase implements org.spincast.core.dictionary.Dictionary
Default implementation of the 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 Details

    • logger

      protected static final org.slf4j.Logger logger
  • Constructor Details

    • SpincastDictionaryDefault

      @Inject public SpincastDictionaryDefault(org.spincast.core.locale.LocaleResolver localeResolver, org.spincast.core.templating.TemplatingEngine templatingEngine, org.spincast.core.config.SpincastConfig spincastConfig, @Nullable Set<org.spincast.core.dictionary.DictionaryEntries> dictionaryEntries)
  • Method Details

    • getDefaultLocale

      protected Locale getDefaultLocale()
    • getTemplatingEngine

      protected org.spincast.core.templating.TemplatingEngine getTemplatingEngine()
    • getSpincastConfig

      protected org.spincast.core.config.SpincastConfig getSpincastConfig()
    • getDictionaryEntries

      protected Set<org.spincast.core.dictionary.DictionaryEntries> getDictionaryEntries()
    • hasKey

      public boolean hasKey(String key)
      Specified by:
      hasKey in interface org.spincast.core.dictionary.Dictionary
    • get

      public String get(String key)
      Gets a message. Will use the proper Locale as provided by the LocaleResolver.
      Specified by:
      get in interface org.spincast.core.dictionary.Dictionary
    • get

      public String get(String key, Locale locale)
      Specified by:
      get in interface org.spincast.core.dictionary.Dictionary
    • get

      public String get(String key, boolean forceTemplatingEngine)
      Gets a message. Will use the proper Locale as provided by the LocaleResolver.
      Specified by:
      get in interface org.spincast.core.dictionary.Dictionary
    • get

      public String get(String key, Locale locale, boolean forceEvaluation)
      Specified by:
      get in interface org.spincast.core.dictionary.Dictionary
    • get

      public final String get(String key, org.spincast.core.utils.Pair... params)
      Gets a message. Will use the proper Locale as provided by the LocaleResolver.
      Specified by:
      get in interface org.spincast.core.dictionary.Dictionary
    • get

      public String get(String key, Locale locale, org.spincast.core.utils.Pair... params)
      Specified by:
      get in interface org.spincast.core.dictionary.Dictionary
    • get

      public String get(String key, Map<String,Object> params)
      Gets a message. Will use the proper Locale as provided by the LocaleResolver.
      Specified by:
      get in interface org.spincast.core.dictionary.Dictionary
    • get

      public String get(String key, Locale locale, Map<String,Object> params)
      Specified by:
      get in interface org.spincast.core.dictionary.Dictionary
    • get

      public String get(String key, Locale locale, Map<String,Object> params, Locale originalLocale)
    • keyNotFound

      protected String keyNotFound(String key, Locale originalLocale, Map<String,Object> params)
    • addCoreAndPluginsMessages

      protected void addCoreAndPluginsMessages()
    • getAll

      public Map<String,String> getAll(String key)
      Specified by:
      getAll in interface org.spincast.core.dictionary.Dictionary
    • getAll

      public Map<String,String> getAll(String key, org.spincast.core.utils.Pair... params)
      Specified by:
      getAll in interface org.spincast.core.dictionary.Dictionary
    • getAll

      public Map<String,String> getAll(String key, Map<String,Object> params)
      Specified by:
      getAll in interface org.spincast.core.dictionary.Dictionary
    • 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")); }