Class LanguageConstantsCallable
- java.lang.Object
-
- de.uplanet.lucy.server.i18n.scripting.velocity.LanguageConstantsCallable
-
- All Implemented Interfaces:
de.uplanet.lucy.server.scripting.velocity.ICallableWithVelocityContext
@VelocityVariable("I18N") @VelocityCallable("instance") public final class LanguageConstantsCallable extends Object implements de.uplanet.lucy.server.scripting.velocity.ICallableWithVelocityContext
-
-
Constructor Summary
Constructors Constructor Description LanguageConstantsCallable(de.uplanet.lucy.server.i18n.ILanguageConstantsProvider p_provider, org.apache.velocity.context.Context p_vc, String p_strLang, String p_strDefaultLang)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description LanguageConstantsCallable
cloneWithNewContext(org.apache.velocity.context.Context p_velocityContext)
Create a copy of the callable with a new Velocity context.String
get(String p_strKey)
Get a localized string in the context language given its key.String
get(String p_strKey, String p_strFallbackValue)
Get a localized string in the context language given its key.String
getByApp(String p_strAppGuid, String p_strKey)
Get a localized string in the context language given its key.String
getByApp(String p_strAppGuid, String p_strKey, String p_strFallbackValue)
Get a localized string in the context language given its key.String
getByAppByLang(String p_strAppGuid, String p_strLang, String p_strKey)
Get a localized string in the given language for the given key.String
getByAppByLang(String p_strAppGuid, String p_strLang, String p_strKey, String p_strFallbackValue)
Get a localized string in the given language for the given key.String
getByLang(String p_strLang, String p_strKey)
Get a localized string in the given language for the given key.String
getByLang(String p_strLang, String p_strKey, String p_strFallbackValue)
Get a localized string in the given language for the given key.
-
-
-
Method Detail
-
cloneWithNewContext
public LanguageConstantsCallable cloneWithNewContext(org.apache.velocity.context.Context p_velocityContext)
Create a copy of the callable with a new Velocity context.- Specified by:
cloneWithNewContext
in interfacede.uplanet.lucy.server.scripting.velocity.ICallableWithVelocityContext
- Parameters:
p_velocityContext
- The new Velocity context.
-
get
public String get(String p_strKey)
Get a localized string in the context language given its key.If there is no value for the given key in the context language, the default language of the portal is used as a fallback. If no fallback is available
null
will be returned.- Parameters:
p_strKey
- The key.- Returns:
- The localized string.
-
get
public String get(String p_strKey, String p_strFallbackValue)
Get a localized string in the context language given its key.If there is no value for the given key in the context language, the default language of the portal is used as a fallback. If no fallback is available then the given fallback will be returned.
- Parameters:
p_strKey
- The key.p_strFallbackValue
- A fallback value that is returned if no value could be found for the given key.- Returns:
- The localized string.
-
getByLang
public String getByLang(String p_strLang, String p_strKey)
Get a localized string in the given language for the given key.If there is no value for the given key in the given language, the default language of the portal is used as a fallback. If no fallback is available
null
will be returned.- Parameters:
p_strLang
- The language.p_strKey
- The key.- Returns:
- The localized string.
-
getByLang
public String getByLang(String p_strLang, String p_strKey, String p_strFallbackValue)
Get a localized string in the given language for the given key.If there is no value for the given key in the given language, the default language of the portal is used as a fallback. If no fallback is available then the given fallback will be returned.
- Parameters:
p_strLang
- The language.p_strKey
- The key.p_strFallbackValue
- A fallback value that is returned if no value could be found for the given key.- Returns:
- The localized string.
-
getByApp
public String getByApp(String p_strAppGuid, String p_strKey)
Get a localized string in the context language given its key.If there is no value for the given key in the context language, the default language of the portal is used as a fallback. If no fallback is available
null
will be returned.- Parameters:
p_strAppGuid
- The GUID of the application the key belongs to.p_strKey
- The key.- Returns:
- The localized string.
-
getByApp
public String getByApp(String p_strAppGuid, String p_strKey, String p_strFallbackValue)
Get a localized string in the context language given its key.If there is no value for the given key in the context language, the default language of the portal is used as a fallback. If no fallback is available then the given fallback will be returned.
- Parameters:
p_strAppGuid
- The GUID of the application the key belongs to.p_strKey
- The key.p_strFallbackValue
- A fallback value that is returned if no value could be found for the given key.- Returns:
- The localized string.
-
getByAppByLang
public String getByAppByLang(String p_strAppGuid, String p_strLang, String p_strKey)
Get a localized string in the given language for the given key.If there is no value for the given key in the given language, the default language of the portal is used as a fallback. If no fallback is available
null
will be returned.- Parameters:
p_strAppGuid
- The GUID of the application the key belongs to.p_strLang
- The language.p_strKey
- The key.- Returns:
- The localized string.
-
getByAppByLang
public String getByAppByLang(String p_strAppGuid, String p_strLang, String p_strKey, String p_strFallbackValue)
Get a localized string in the given language for the given key.If there is no value for the given key in the given language, the default language of the portal is used as a fallback. If no fallback is available then the given fallback will be returned.
- Parameters:
p_strAppGuid
- The GUID of the application the key belongs to.p_strLang
- The language.p_strKey
- The key.p_strFallbackValue
- A fallback value that is returned if no value could be found for the given key.- Returns:
- The localized string.
-
-