Interface TranslationResolver

All Known Implementing Classes:
PropertiesTranslationResolver

public interface TranslationResolver
An interface for resolving translations based on a key and a Locale.

Through implementations of the TranslationResolver MVC views shall be able to receive translations from different, prioritized sources, e.g. properties files or a database.

Please note, that the Locale gets resolved by the implementations of the TranslationResolver interface.
Author:
Tobias Erdle
  • Method Summary

    Modifier and Type
    Method
    Description
    Resolve the translation for a string key.
    resolve(String key, Object... args)
    Resolve the translation for a string key.
  • Method Details

    • resolve

      String resolve(String key)
      Resolve the translation for a string key.

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

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

      String resolve(String key, Object... args)
      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.

      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