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 Locale
getCurrentLanguage()
List<Locale>
getLanguages()
org.springframework.context.support.ResourceBundleMessageSource
getMessageSource()
Locale
getSupportedLanguage(String locale)
String
getTranslatedString(String key)
String
getTranslatedString(String locale, String key)
void
setCurrentlanguage(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_VARIANT
or simplelanguage
. Comparison is case-insensitive. See the contents ofi18n
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.
-
-