public class MessageSource
extends GroovyObjectSupport
Message source backed up by one or more ResourceBundle instances for simple i18n support.
| Constructor and description |
|---|
MessageSource(String[] names)Creates a message source backed by the named resource bundles. |
MessageSource(String name)Creates a message source backed by a single named resource bundle. |
MessageSource(Class[] types)Creates a message source backed by bundles named after the supplied types. |
MessageSource(Class type)Creates a message source backed by the bundle named after the supplied type. |
| Type Params | Return Type | Name and description |
|---|---|---|
|
public String |
format(String code, Object[] args)Format a message (based on MessageFormat) using the message from the resource bundles using the given code as a pattern and the given objects as arguments. |
|
public String |
getMessage(String code)Get a raw message from the resource bundles using the given code. |
|
public Object |
getProperty(String name)
|
| Methods inherited from class | Name |
|---|---|
class GroovyObjectSupport |
getMetaClass, setMetaClass |
Creates a message source backed by the named resource bundles.
names - the bundle base names to searchCreates a message source backed by a single named resource bundle.
name - the bundle base nameCreates a message source backed by bundles named after the supplied types.
types - the types whose names identify resource bundlesCreates a message source backed by the bundle named after the supplied type.
type - the type whose name identifies a resource bundleFormat a message (based on MessageFormat) using the message from the resource bundles using the given code as a pattern and the given objects as arguments.
Get a raw message from the resource bundles using the given code.
Copyright © 2003-2026 The Apache Software Foundation. All rights reserved.