TV-Browser 2.7.5 API

util.ui
Class Localizer

java.lang.Object
  extended by util.ui.Localizer

public class Localizer
extends Object

Does the localization of texts.

Each class that uses String that reach the user interface has its own Localizer. You can get a localized String by using one of the msg methods.

The msg methods have all the same pattern:
String msg(key, defaultValue, [args]);

Author:
Til Schneider, www.murfman.de

Field Summary
static String I18N_ADD
           
static String I18N_BACK
           
static String I18N_CANCEL
           
static String I18N_CHANNEL
           
static String I18N_CHANNELS
           
static String I18N_CLOSE
           
static String I18N_DEFAULT
           
static String I18N_DELETE
           
static String I18N_DOWN
           
static String I18N_EDIT
           
static String I18N_ERROR
           
static String I18N_FILE
           
static String I18N_HELP
           
static String I18N_LEFT
           
static String I18N_NEXT
           
static String I18N_OK
           
static String I18N_OPTIONS
           
static String I18N_PICTURES
           
static String I18N_PROGRAM
           
static String I18N_PROGRAMS
           
static String I18N_RIGHT
           
static String I18N_SELECT
           
static String I18N_SETTINGS
           
static String I18N_STANDARD
           
static String I18N_TODAY
           
static String I18N_TOMORROW
           
static String I18N_UP
           
static String I18N_YESTERDAY
           
 
Method Summary
static void emptyLocalizerCache()
          Clears the localizer cache.
 Locale[] getAllAvailableLocales()
          Scans all Language-Directories for different Versions of tvbrowser/tvbrowser.properties.
static String getLocalization(String key)
           
static Localizer getLocalizerFor(Class clazz)
          Gets the Localizer for the specified Class.
 String msg(String key, String defaultMsg)
          Gets a localized message.
 String msg(String key, String defaultMsg, boolean warn)
          Gets a localized message.
 String msg(String key, String defaultMsg, Object arg1)
          Gets a localized message.
 String msg(String key, String defaultMsg, Object[] args)
          Gets a localized message.
 String msg(String key, String defaultMsg, Object arg1, Object arg2)
          Gets a localized message.
 String msg(String key, String defaultMsg, Object arg1, Object arg2, Object arg3)
          Gets a localized message.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

I18N_OK

public static final String I18N_OK
See Also:
Constant Field Values

I18N_CANCEL

public static final String I18N_CANCEL
See Also:
Constant Field Values

I18N_CLOSE

public static final String I18N_CLOSE
See Also:
Constant Field Values

I18N_DELETE

public static final String I18N_DELETE
See Also:
Constant Field Values

I18N_EDIT

public static final String I18N_EDIT
See Also:
Constant Field Values

I18N_PROGRAM

public static final String I18N_PROGRAM
See Also:
Constant Field Values

I18N_PROGRAMS

public static final String I18N_PROGRAMS
See Also:
Constant Field Values

I18N_CHANNEL

public static final String I18N_CHANNEL
See Also:
Constant Field Values

I18N_CHANNELS

public static final String I18N_CHANNELS
See Also:
Constant Field Values

I18N_HELP

public static final String I18N_HELP
See Also:
Constant Field Values

I18N_FILE

public static final String I18N_FILE
See Also:
Constant Field Values

I18N_ADD

public static final String I18N_ADD
See Also:
Constant Field Values

I18N_SETTINGS

public static final String I18N_SETTINGS
See Also:
Constant Field Values

I18N_UP

public static final String I18N_UP
See Also:
Constant Field Values

I18N_DOWN

public static final String I18N_DOWN
See Also:
Constant Field Values

I18N_LEFT

public static final String I18N_LEFT
See Also:
Constant Field Values

I18N_RIGHT

public static final String I18N_RIGHT
See Also:
Constant Field Values

I18N_BACK

public static final String I18N_BACK
See Also:
Constant Field Values

I18N_NEXT

public static final String I18N_NEXT
See Also:
Constant Field Values

I18N_PICTURES

public static final String I18N_PICTURES
See Also:
Constant Field Values

I18N_OPTIONS

public static final String I18N_OPTIONS
See Also:
Constant Field Values

I18N_SELECT

public static final String I18N_SELECT
See Also:
Constant Field Values

I18N_ERROR

public static final String I18N_ERROR
See Also:
Constant Field Values

I18N_DEFAULT

public static final String I18N_DEFAULT
See Also:
Constant Field Values

I18N_STANDARD

public static final String I18N_STANDARD
See Also:
Constant Field Values

I18N_YESTERDAY

public static final String I18N_YESTERDAY
See Also:
Constant Field Values

I18N_TODAY

public static final String I18N_TODAY
See Also:
Constant Field Values

I18N_TOMORROW

public static final String I18N_TOMORROW
See Also:
Constant Field Values
Method Detail

getLocalizerFor

public static Localizer getLocalizerFor(Class clazz)
Gets the Localizer for the specified Class.

Parameters:
clazz - The Class to get the localizer for.
Returns:
the Localizer for the specified Class.

emptyLocalizerCache

public static void emptyLocalizerCache()
Clears the localizer cache.


msg

public String msg(String key,
                  String defaultMsg,
                  Object arg1)
Gets a localized message.

Parameters:
key - The key of the message.
defaultMsg - The default message (English)
arg1 - The argument that should replace {0}.
Returns:
a localized message.

msg

public String msg(String key,
                  String defaultMsg,
                  Object arg1,
                  Object arg2)
Gets a localized message.

Parameters:
key - The key of the message.
defaultMsg - The default message. (English)
arg1 - The argument that should replace {0}.
arg2 - The argument that should replace {1}.
Returns:
a localized message.

msg

public String msg(String key,
                  String defaultMsg,
                  Object arg1,
                  Object arg2,
                  Object arg3)
Gets a localized message.

Parameters:
key - The key of the message.
defaultMsg - The default message. (English)
arg1 - The argument that should replace {0}.
arg2 - The argument that should replace {1}.
arg3 - The argument that should replace {2}.
Returns:
a localized message.

msg

public String msg(String key,
                  String defaultMsg,
                  Object[] args)
Gets a localized message.

Parameters:
key - The key of the message.
defaultMsg - The default message. (English)
args - The arguments that should replace the appropriate place holder. See MessageFormat for details.
Returns:
a localized message.

msg

public String msg(String key,
                  String defaultMsg)
Gets a localized message.

Parameters:
key - The key of the message.
defaultMsg - The default message (English)
Returns:
a localized message.

msg

public String msg(String key,
                  String defaultMsg,
                  boolean warn)
Gets a localized message.

Parameters:
key - The key of the message.
defaultMsg - The default message (English)
warn - If warnings should be logged if key is not found.
Returns:
a localized message.
Since:
2.5.1

getAllAvailableLocales

public Locale[] getAllAvailableLocales()
Scans all Language-Directories for different Versions of tvbrowser/tvbrowser.properties. This is faster than analyzing all Files

Returns:
all available Locales
Since:
2.3

getLocalization

public static String getLocalization(String key)

TV-Browser 2.7.5 API

TV-Browser 2.7.5, Copyright (C) 04-2003 Martin Oberhauser (martin@tvbrowser.org)