Class PropertiesTranslationResolver

java.lang.Object
de.chkal.mvctoolbox.core.translation.PropertiesTranslationResolver
All Implemented Interfaces:
TranslationResolver

public class PropertiesTranslationResolver extends Object implements TranslationResolver
Resolves translations from a resource bundle with a configurable base name. The Locale for the processed request will be resolved by the applied MvcContext.
Author:
Tobias Erdle
  • Constructor Details

    • PropertiesTranslationResolver

      public PropertiesTranslationResolver(String resourceBundleName, jakarta.mvc.MvcContext mvcContext)
  • Method Details

    • resolve

      public String resolve(String key)
      Description copied from interface: TranslationResolver
      Resolve the translation for a string key.

      The Locale must be resolved by the implementation of this interface.

      Specified by:
      resolve in interface TranslationResolver
      Parameters:
      key - the string key for which translations shall be resolved
      Returns:
      the found translation or null, when the key doesn't exist
    • resolve

      public String resolve(String key, Object... args)
      Description copied from interface: TranslationResolver
      Resolve the translation for a string key. The translation may be a MessageFormat template which can be enriched with custom arguments.

      The Locale must be resolved by the implementation of this interface.

      Specified by:
      resolve in interface TranslationResolver
      Parameters:
      key - the string key for which translations shall be resolved
      args - an array of variable length containing placeholder values
      Returns:
      the found translation with filled placeholders or null, when the key doesn't exist