Package org.mule.config.i18n

Internationalisation support for Mule messages and exception messages.

See: Description

Package org.mule.config.i18n Description

Internationalisation support for Mule messages and exception messages.

The Message class is a wrapper for an error message, its error code and other information. The messages are read from ResourceBundles usually from classpath.

The class MessageFactory encapsulates the lookup of ResourceBundles and creation of messages. Since each mule module should provide its own messages, subclasses of MessageFactory should be created. It is convention to put the module specific class in a subpackage called i18n.

Subclassing MessageFactory

For a mule module foo with base package org.mule.module.foo a MessageFactory subclass would typcially look like this:
package org.mule.module.foo.i18n;

public class FooMessages extends MessageFactory
{
    private static final String BUNDLE_PATH = getBundlePath("foo");
    
    public static final Message foo()
    {
        return createMessage(BUNDLE_PATH, 1);
    }
    
    public static final Message bar(String arg)
    {
        return createMessage(BUNDLE_PATH, 2, arg);
    }
    
    .
    .
    .
}
Note that the only publicly available methods are those from FooMessages. This approach has various advantages:

Copyright © 2003–2016 MuleSoft, Inc.. All rights reserved.