Loading…

Kryptel/Java

Message class

Declaration

package com.kryptel;

public final class Message {

    public enum Code { . . . }      // Message codes

    public interface ILocalizedMessage {
        String Get(Code code);
    }


    public static void Localize(ILocalizedMessage localizer)

    public static String Get(Code code)

    public static String GetDefaultMessage(Code code)

}

Description

This class contains all library text messages. Partly they are error messages associated with library exceptions, and partly various informational messages.

ILocalizedMessage

public interface ILocalizedMessage {
    String Get(Code code);
}

If the client has created a message translation class, the library uses this interface to access translated messages. See Library Localization article for a usage example.

Localize

public static void Localize(ILocalizedMessage localizer)

This function attaches a client-created translation class to the Message class. See Library Localization article for a usage example.

Get

public static String Get(Code code)

For the specified message code returns the corresponding message string. If a localization is connected, and there is a translation for the requested message, then the translated message is returned.

GetDefaultMessage

public static String GetDefaultMessage(Code code)

Like the Get function, this function returns a message string with the specified code. However this function ignores an attached localization class and always returns the default English message.