Interface I18nHelper

All Known Implementing Classes:
DefaultI18nHelper

public interface I18nHelper
Simple helper tool for getting translated strings.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final Locale
    Special locale that makes helper to return untranslated translation keys instead of translations.
    static final String
    Special language tag that makes helper to return untranslated translation keys instead of translations.
  • Method Summary

    Modifier and Type
    Method
    Description
    getText(String key, Object... args)
    Get translated string for provided key for current user locale.
    getText(Locale locale, String key, Object... args)
    Get translated string for provided key for provided locale.
  • Field Details

    • SYNTHETIC_LANGUAGE_TAG

      static final String SYNTHETIC_LANGUAGE_TAG
      Special language tag that makes helper to return untranslated translation keys instead of translations.
      See Also:
    • SYNTHETIC_LANGUAGE

      static final Locale SYNTHETIC_LANGUAGE
      Special locale that makes helper to return untranslated translation keys instead of translations.
  • Method Details

    • getText

      String getText(String key, Object... args)
      Get translated string for provided key for current user locale.
      Parameters:
      key - translation key (can be either simple key or pair namespace:key) Examples: `key.to.translate`, `common:key.to.translate`
      args - values to pass into translation
      Returns:
      translated string
    • getText

      String getText(Locale locale, String key, Object... args)
      Get translated string for provided key for provided locale.
      Parameters:
      locale - requested locale of translation
      key - translation key (can be either simple key or pair namespace:key) Examples: `key.to.translate`, `common:key.to.translate`
      args - values to pass into translation
      Returns:
      translated string