Class TranslationService


  • @Service
    public class TranslationService
    extends Object
    This service provides I18N support for the application
    Author:
    Charles Edward Bedon Cortazar <charles.bedon@kuwaiba.org>
    • Constructor Detail

      • TranslationService

        public TranslationService()
    • Method Detail

      • getCurrentLanguage

        public Locale getCurrentLanguage()
      • getSupportedLanguage

        public Locale getSupportedLanguage​(String locale)
      • getMessageSource

        public org.springframework.context.support.ResourceBundleMessageSource getMessageSource()
      • setCurrentlanguage

        public void setCurrentlanguage​(String locale)
                                throws IllegalArgumentException
        Sets the current language through a locale.
        Parameters:
        locale - The locale string. This might be in the form language_VARIANT or simple language. Comparison is case-insensitive. See the contents of i18n resource folder in this project for currently supported languages. If not found, it will fallback to English.
        Throws:
        IllegalArgumentException - If the locale is not supported.
      • getLanguages

        public List<Locale> getLanguages()
      • getTranslatedString

        public String getTranslatedString​(String key)