Package org.neotropic.kuwaiba.core.i18n
Class TranslationService
- java.lang.Object
-
- org.neotropic.kuwaiba.core.i18n.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 Summary
Constructors Constructor Description TranslationService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description LocalegetCurrentLanguage()List<Locale>getLanguages()org.springframework.context.support.ResourceBundleMessageSourcegetMessageSource()LocalegetSupportedLanguage(String locale)StringgetTranslatedString(String key)StringgetTranslatedString(String locale, String key)voidsetCurrentlanguage(String locale)Sets the current language through a locale.
-
-
-
Method Detail
-
getCurrentLanguage
public Locale getCurrentLanguage()
-
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 formlanguage_VARIANTor simplelanguage. Comparison is case-insensitive. See the contents ofi18nresource folder in this project for currently supported languages. If not found, it will fallback to English.- Throws:
IllegalArgumentException- If the locale is not supported.
-
-