Venice 0.751beta

nz.org.venice.util
Class Locale

java.lang.Object
  extended bynz.org.venice.util.Locale

public class Locale
extends java.lang.Object

This class implements internationalisation support for Venice. Each text message displayed by Venice is represented by a string symbol (e.g. "OPEN") which describes the error message being displayed. This symbol is then matched to a internationalistaion file which will then retrieve the local language version of that error message.

If a match could not be found in the current language, it will try to match the symbol in the english (default) language. If it could not find a match there, it will display the string Locale.UNKNOWN.

The internationalisation files are kept in src/nz/org/venice/util/locale/.

Author:
Andrew Leppard
See Also:
ResourceBundle

Method Summary
static java.util.Locale getLocale()
          Get the localization.
static java.lang.String getString(java.lang.String key)
          Return the current language translation of the text associated with the given key.
static java.lang.String getString(java.lang.String key, double arg1, double arg2)
          Return the current language translation of the text associated with the given key.
static java.lang.String getString(java.lang.String key, int arg1)
          Return the current language translation of the text associated with the given key.
static java.lang.String getString(java.lang.String key, int arg1, int arg2)
          Return the current language translation of the text associated with the given key.
static java.lang.String getString(java.lang.String key, int arg1, int arg2, int arg3)
           
static java.lang.String getString(java.lang.String key, java.lang.String arg1)
          Return the current language translation of the text associated with the given key.
static java.lang.String getString(java.lang.String key, java.lang.String arg1, java.lang.String arg2)
          Return the current language translation of the text associated with the given key.
static java.lang.String getString(java.lang.String key, java.lang.String arg1, java.lang.String arg2, java.lang.String arg3)
          Return the current language translation of the text associated with the given key.
static void setLocale()
          Set the localization as got from saved preferences.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

setLocale

public static void setLocale()
Set the localization as got from saved preferences. If no preference is set for the language it get the current system language.


getLocale

public static java.util.Locale getLocale()
Get the localization.

Returns:
the current localization

getString

public static java.lang.String getString(java.lang.String key)
Return the current language translation of the text associated with the given key.

Parameters:
key - a key which represents a line of text
Returns:
the text

getString

public static java.lang.String getString(java.lang.String key,
                                         java.lang.String arg1)
Return the current language translation of the text associated with the given key. Insert the given argument into the text translation. For example if the text object in the internationalisation file looks like:
Generation %1
The first argument will replace %1.

Parameters:
key - a key which represents a line of text
arg1 - the first argument
Returns:
the text

getString

public static java.lang.String getString(java.lang.String key,
                                         java.lang.String arg1,
                                         java.lang.String arg2)
Return the current language translation of the text associated with the given key. Insert the given arguments into the text translation. For example if the text object in the internationalisation file looks like:
Generation %1 of %2
The first argument will replace %1 and the second argument will replace %2.

Parameters:
key - a key which represents a line of text
arg1 - the first argument
arg2 - the second argument
Returns:
the text

getString

public static java.lang.String getString(java.lang.String key,
                                         java.lang.String arg1,
                                         java.lang.String arg2,
                                         java.lang.String arg3)
Return the current language translation of the text associated with the given key. Insert the given arguments into the text translation. For example if the text object in the internationalisation file looks like:
%1 of %2 (%3%)
The first argument will replace %1 and the second argument will replace %2 and the third argument will replace %3.

Parameters:
key - a key which represents a line of text
arg1 - the first argument
arg2 - the second argument
arg3 - the third argument
Returns:
the text

getString

public static java.lang.String getString(java.lang.String key,
                                         int arg1)
Return the current language translation of the text associated with the given key. Insert the given argument into the text translation. For example if the text object in the internationalisation file looks like:
Generation %1
The first argument will replace %1.

Parameters:
key - a key which represents a line of text
arg1 - the first argument
Returns:
the text

getString

public static java.lang.String getString(java.lang.String key,
                                         int arg1,
                                         int arg2)
Return the current language translation of the text associated with the given key. Insert the given arguments into the text translation. For example if the text object in the internationalisation file looks like:
Generation %1 of %2
The first argument will replace %1 and the second argument will replace %2.

Parameters:
key - a key which represents a line of text
arg1 - the first argument
arg2 - the second argument
Returns:
the text

getString

public static java.lang.String getString(java.lang.String key,
                                         int arg1,
                                         int arg2,
                                         int arg3)

getString

public static java.lang.String getString(java.lang.String key,
                                         double arg1,
                                         double arg2)
Return the current language translation of the text associated with the given key. Insert the given arguments into the text translation. For example if the text object in the internationalisation file looks like:
Generation %1 of %2
The first argument will replace %1 and the second argument will replace %2.

Parameters:
key - a key which represents a line of text
arg1 - the first argument
arg2 - the second argument
Returns:
the text

Venice 0.751beta