LPEX
4.4.0

com.ibm.lpex.core
Class LpexResources

java.lang.Object
  extended by com.ibm.lpex.core.LpexResources

public final class LpexResources
extends Object

This class can be used to access a resource file of the editor. Methods without a resource-bundle argument use the editor's main resource file, com.ibm.lpex.core.Resources.properties.

In the resource files accessed by this class, for any single-quote (apostrophe) ' which is part of the text, two single-quotes '' must always be used. A single-quote is otherwise considered the start of quoted (not interpreted) text, and is discarded from the message returned, along with the corresponding closing single-quote. This feature is intended to simplify usage and eliminate incorrect translations that are typical with the java.text.MessageFormat class. Examples:

 
 action.keyInvalid="{0}" n''est pas une touche d''action valide. 
 noSubstitution=Use '{0}, {1}, .., {n}' for substitutions. 

The only format element supported is an argument index.


Method Summary
static String message(ResourceBundle resourceBundle, String key)
          Retrieve from the specified resource file the resource string with the specified key.
static String message(ResourceBundle resourceBundle, String key, int arg1)
          Retrieve from the specified resource file the resource string with the specified key and a single integer substitution argument.
static String message(ResourceBundle resourceBundle, String key, int arg1, int arg2)
          Retrieve from the specified resource file the resource string with the specified key and two integer substitution arguments.
static String message(ResourceBundle resourceBundle, String key, Object[] arguments)
          Retrieves from the specified resource file the resource string with the specified key and performs argument substitution.
static String message(ResourceBundle resourceBundle, String key, String arg1)
          Retrieve from the specified resource file the resource string with the specified key and a single substitution argument.
static String message(ResourceBundle resourceBundle, String key, String arg1, String arg2)
          Retrieve from the specified resource file the resource string with the specified key and two substitution arguments.
static String message(String key)
          Retrieve from the editor's main resource file the resource string with the specified key.
static String message(String key, int arg1)
          Retrieve from the editor's main resource file the resource string with the specified key and a single integer substitution argument.
static String message(String key, int arg1, int arg2)
          Retrieve from the editor's main resource file the resource string with the specified key and two integer substitution arguments.
static String message(String key, Object[] arguments)
          Retrieve from the editor's main resource file the resource string with the specified key and perform argument substitution.
static String message(String key, String arg1)
          Retrieve from the editor's main resource file the resource string with the specified key and a single substitution argument.
static String message(String key, String arg1, String arg2)
          Retrieve from the editor's main resource file the resource string with the specified key and two substitution arguments.
static String[] textMnemonic(String key)
          Separate the '&' symbol from the text used for a label or caption.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

message

public static String message(String key)
Retrieve from the editor's main resource file the resource string with the specified key.

Returns:
null if not found

message

public static String message(ResourceBundle resourceBundle,
                             String key)
Retrieve from the specified resource file the resource string with the specified key.

Returns:
null if not found

message

public static String message(String key,
                             Object[] arguments)
Retrieve from the editor's main resource file the resource string with the specified key and perform argument substitution.

Message substitution is indicated by {n} (where n = 0 .. 9); to display braces, enclose them in single quotes (e.g., '{'); to display a single quote, use two consecutive single quote characters.

Returns:
null if message not found

message

public static String message(ResourceBundle resourceBundle,
                             String key,
                             Object[] arguments)
Retrieves from the specified resource file the resource string with the specified key and performs argument substitution.

Message substitution is indicated by {n} (where n = 0 .. 9); to display braces, enclose them in single quotes (e.g., '{'); to display a single quote, use two consecutive single quote characters.

Returns:
null if message not found

message

public static String message(String key,
                             int arg1)
Retrieve from the editor's main resource file the resource string with the specified key and a single integer substitution argument.

Returns:
null if not found

message

public static String message(ResourceBundle resourceBundle,
                             String key,
                             int arg1)
Retrieve from the specified resource file the resource string with the specified key and a single integer substitution argument.

Returns:
null if not found

message

public static String message(String key,
                             int arg1,
                             int arg2)
Retrieve from the editor's main resource file the resource string with the specified key and two integer substitution arguments.

Returns:
null if not found

message

public static String message(ResourceBundle resourceBundle,
                             String key,
                             int arg1,
                             int arg2)
Retrieve from the specified resource file the resource string with the specified key and two integer substitution arguments.

Returns:
null if not found

message

public static String message(String key,
                             String arg1)
Retrieve from the editor's main resource file the resource string with the specified key and a single substitution argument.

Returns:
null if not found

message

public static String message(ResourceBundle resourceBundle,
                             String key,
                             String arg1)
Retrieve from the specified resource file the resource string with the specified key and a single substitution argument.

Returns:
null if not found

message

public static String message(String key,
                             String arg1,
                             String arg2)
Retrieve from the editor's main resource file the resource string with the specified key and two substitution arguments.

Returns:
null if not found

message

public static String message(ResourceBundle resourceBundle,
                             String key,
                             String arg1,
                             String arg2)
Retrieve from the specified resource file the resource string with the specified key and two substitution arguments.

Returns:
null if not found

textMnemonic

public static String[] textMnemonic(String key)
Separate the '&' symbol from the text used for a label or caption.

Parameters:
key - the key into Resources.properties
Returns:
an array of two Strings, whose first element is the text without the '&', and whose second element is an uppercased String whose only letter is the mnemonic; if no '&' is found, the second element is null

LPEX
4.4.0

Copyright � 2016 IBM Corp. All Rights Reserved.

Note: This documentation is for part of an interim API that is still under development and expected to change significantly before reaching stability. It is being made available at this early stage to solicit feedback from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken (repeatedly) as the API evolves.