cds.util
Class Messages

java.lang.Object
  extended bycds.util.Messages

public class Messages
extends java.lang.Object

Class managing all the texts, messages, button names, etc. which can be written in french or english. This class needs first to load a Parameters file which internal name must be "msg_and_texts". This parameter file can contain several sections containing independant messages and texts. Each entry has the syntax:
MSGNAME = texte francais/english text
'/' is the separator. Every section can define its own in an entry 'separator = x'

Version:
1.0 mar 2002 (JPL)
2.0 jun 2002 (MW) reorganisation. Defined as static. Recalled Messages, 2.1 nov 2003 (BB) FRANCAIS et ENGLISH -> public au lieu de private
Author:
Jean-Philippe Lejal (stage CDS 2002), Marc Wenger/CDS, Benoît Baranne

Field Summary
private static java.lang.String DEFAULT_SEPARATOR
           
static int ENGLISH
           
static int FRANCAIS
           
private static java.lang.String[] langName
           
private static int language
           
private static Parameters msgTable
           
private static java.lang.String paramName
           
private static java.lang.String SEPARATOR_KEY
           
 
Constructor Summary
Messages()
           
 
Method Summary
static java.lang.String get(java.lang.String key)
          get a message in the current language
static java.lang.String get(java.lang.String sect, java.lang.String key)
          get a message in the current language
static java.lang.String getLanguage()
          Returns the currently implemented language
private static void loadLanguage()
          Creates the 'language' Parameters object with the messages corresponding to the current language
static void setLanguage(int lang)
          Changes the language and (re)loads the right messages
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FRANCAIS

public static final int FRANCAIS
See Also:
Constant Field Values

ENGLISH

public static final int ENGLISH
See Also:
Constant Field Values

langName

private static final java.lang.String[] langName

SEPARATOR_KEY

private static final java.lang.String SEPARATOR_KEY
See Also:
Constant Field Values

DEFAULT_SEPARATOR

private static final java.lang.String DEFAULT_SEPARATOR
See Also:
Constant Field Values

paramName

private static java.lang.String paramName

language

private static int language

msgTable

private static Parameters msgTable
Constructor Detail

Messages

public Messages()
Method Detail

setLanguage

public static void setLanguage(int lang)
Changes the language and (re)loads the right messages

Parameters:
lang - language to implement (Messages.FRANCAIS, Messages.ENGLISH)

getLanguage

public static java.lang.String getLanguage()
Returns the currently implemented language

Returns:
language name

loadLanguage

private static void loadLanguage()
Creates the 'language' Parameters object with the messages corresponding to the current language


get

public static java.lang.String get(java.lang.String key)
get a message in the current language

Parameters:
key - name of the message
Returns:
the 'value' of the message in the current language

get

public static java.lang.String get(java.lang.String sect,
                                   java.lang.String key)
get a message in the current language

Parameters:
sect - message section
key - name of the message
Returns:
the 'value' of the message in the current language