Class GroovyLanguageConstants
- java.lang.Object
-
- de.uplanet.lucy.server.i18n.scripting.groovy.GroovyLanguageConstants
-
@Scriptable public final class GroovyLanguageConstants extends Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
GroovyLanguageConstants.GLCApplications
-
Constructor Summary
Constructors Constructor Description GroovyLanguageConstants(Supplier<de.uplanet.lucy.server.i18n.ILanguageConstants> p_constantsSupplier, String p_strLang, String p_strFallbackLang)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description GroovyLanguageConstants.GLCApplications
application(String p_strAppGuid)
Get an accessor for application language constants.String
get(String p_strKey)
Get the value of the given language constant.String
getAt(String p_strKey)
Get the value of the given language constant.String
getFallbackLanguage()
Get the fallback language that is used when a language constant is not found in thecontext language
.String
getLanguage()
Get the context language set for this object.GroovyLanguageConstants
language(String p_strLang)
Get the language constants for the specified language.
-
-
-
Method Detail
-
getLanguage
public String getLanguage()
Get the context language set for this object.- Returns:
- The context language.
-
getFallbackLanguage
public String getFallbackLanguage()
Get the fallback language that is used when a language constant is not found in thecontext language
.Usually this is the portal's default language.
- Returns:
- The default language.
-
language
public GroovyLanguageConstants language(String p_strLang)
Get the language constants for the specified language.This can be useful when another than the predefined context language should be used.
def en = g_i18n.language("en")
- Parameters:
p_strLang
- The language.- Returns:
- The language constants for the specified language.
-
application
public GroovyLanguageConstants.GLCApplications application(String p_strAppGuid)
Get an accessor for application language constants.- Parameters:
p_strAppGuid
- The application GUID.- Returns:
- An accessor for the given application.
-
getAt
public String getAt(String p_strKey)
Get the value of the given language constant. If there is no value for the given key in the context language, the fallback language is used. If no fallback is availablenull
will be returned.def strValue = g_i18n["CONSTANT_NAME"]
- Parameters:
p_strKey
- The key.- Returns:
- The localized string.
-
get
public String get(String p_strKey)
Get the value of the given language constant. If there is no value for the given key in the context language, the fallback language is used. If no fallback is availablenull
will be returned.def strValue = g_i18n.CONSTANT_NAME
- Parameters:
p_strKey
- The key.- Returns:
- The localized string.
-
-