public class LocalisationService
extends java.lang.Object
There are a couple of supported languages but in case that suggested language is not supported, the default language 'English' will be used. Moreover, the language labels are defined in various string_<LANGUAGE-CODE>.properties files located in the business logic project under '/<project-root>/resources/localization/'. This class is responsible to read a language label for a chosen language from the string_<lang>.properties file and supply the language label to compose a business logic webpage or return a message reply to the Business Bot Platform (which is send to the instant messenger user).
Modifier and Type | Field and Description |
---|---|
java.util.HashMap<java.lang.String,java.lang.String> |
pluginMap |
Constructor and Description |
---|
LocalisationService(java.util.HashMap<java.lang.String,java.lang.String> pluginMap)
Private constructor due to singleton
|
Modifier and Type | Method and Description |
---|---|
static <T,E> java.lang.String |
getLanguageCodeByName(E value)
Get language code by name
|
java.lang.String |
getString(java.lang.String key)
Get a string in default language (en)
|
java.lang.String |
getString(java.lang.String key,
java.lang.String language)
Get a string in default language
|
java.util.HashMap<java.lang.String,java.lang.String> |
getSupportedLanguages() |
boolean |
isLanguageCodeSupported(java.lang.String languageCode)
Check if language is supported
|
public LocalisationService(java.util.HashMap<java.lang.String,java.lang.String> pluginMap)
pluginMap
- the plugin mappublic java.lang.String getString(java.lang.String key)
key
- key of the resource to fetchpublic java.lang.String getString(java.lang.String key, java.lang.String language)
key
- the key of the resource to fetchlanguage
- the language of the key (e.g. en = english; de=german)public java.util.HashMap<java.lang.String,java.lang.String> getSupportedLanguages()
public static <T,E> java.lang.String getLanguageCodeByName(E value)
T
- This is the type parameterE
- This is the enum parametervalue
- the value (e.g. english)language code
(e.g. en) on success; otherwise null
public boolean isLanguageCodeSupported(java.lang.String languageCode)
languageCode
- the language codetrue
if language is supported; otherwise false
Copyright © 2019 Citunius GmbH. All Rights Reserved.