|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.sf.freecol.client.gui.i18n.Messages
public class Messages
Represents a collection of messages in a particular locale.
This class is NOT thread-safe. (CO: I cannot find any place that really has a problem) Messages are put in the file "FreeColMessages.properties". This file is presently located in the same directory as the source file of this class.
| Field Summary | |
|---|---|
static java.lang.String |
FILE_PREFIX
|
static java.lang.String |
FILE_SUFFIX
|
private static java.util.logging.Logger |
logger
|
private static java.util.Properties |
messageBundle
|
static java.lang.String |
STRINGS_DIRECTORY
|
| Constructor Summary | |
|---|---|
Messages()
|
|
| Method Summary | |
|---|---|
static boolean |
containsKey(java.lang.String key)
Returns true if the message bundle contains the given key. |
static java.lang.String |
getDescription(FreeColObject object)
Returns the localized description of a FreeColObject. |
static java.io.File |
getI18nDirectory()
Returns the directory containing language property files. |
static java.lang.String |
getKey(java.lang.String preferredKey,
java.lang.String defaultKey)
Returns the preferred key if it is contained in the message bundle and the default key otherwise. |
static java.lang.String |
getLabel(ColonyTile colonyTile)
Returns a description of the tile, with the name of the tile and any improvements made to it (road/plow). |
static java.lang.String |
getLabel(Goods goods)
Returns a description of the goods. |
static java.lang.String |
getLabel(GoodsType type,
int amount)
Returns a description of the goods. |
static java.lang.String |
getLabel(Tile tile)
Returns a description of the Tile, with the name of the tile
and any improvements on it (road/plow/etc) from TileItemContainer. |
static java.lang.String |
getLabel(TileItemContainer tic)
Returns a description of the tile, with the name of the tile and any improvements made to it (road/plow) |
static java.lang.String |
getLabel(Unit unit)
Returns the name of a unit in a human readable format. |
static java.lang.String |
getLabel(UnitType someType,
Unit.Role someRole)
Returns the name of a unit in a human readable format. |
static java.lang.String |
getLocationName(Building building)
Returns the location name of the given Building. |
static java.lang.String |
getLocationName(ColonyTile colonyTile)
Returns the (non-unique) name of the given ColonyTile. |
static java.lang.String |
getLocationName(Location location)
Describe getLocationName method here. |
static java.lang.String |
getLocationName(Tile tile)
Returns the location name of the given Tile. |
static java.lang.String |
getLocationName(Unit unit)
Returns a name for this unit, as a location. |
static java.lang.String |
getName(Feature object)
Returns the localized name of a Feature. |
static java.lang.String |
getName(FoundingFather.FoundingFatherType type)
Return the localized type of the given FoundingFather. |
static java.lang.String |
getName(FreeColGameObjectType object)
Returns the localized name of a FreeColGameObjectType. |
static java.lang.String |
getName(Tile tile)
Gets the name of a Tile, or shows "unexplored" if not explored by player. |
static java.lang.String |
getName(Typed object)
Returns the localized name of a FreeColGameObject implementing the Typed interface. |
static java.lang.String |
getNationAsString(Player player)
Returns the nation of the given player as a String. |
static void |
loadResources(java.io.File resourceFile)
Calling this method can be used to replace the messages used currently with a new bundle. |
static java.lang.String |
message(java.lang.String messageId,
java.lang.String... data)
Finds the message with a particular ID in the default locale and performs string replacements. |
static void |
setMessageBundle(java.util.Locale locale)
Set the resource bundle for the given locale |
private static void |
setMessageBundle(java.lang.String language,
java.lang.String country,
java.lang.String variant)
Set the resource bundle to the given locale |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private static final java.util.logging.Logger logger
public static final java.lang.String STRINGS_DIRECTORY
public static final java.lang.String FILE_PREFIX
public static final java.lang.String FILE_SUFFIX
private static java.util.Properties messageBundle
| Constructor Detail |
|---|
public Messages()
| Method Detail |
|---|
public static void setMessageBundle(java.util.Locale locale)
locale -
private static void setMessageBundle(java.lang.String language,
java.lang.String country,
java.lang.String variant)
language - The language for this locale.country - The language for this locale.variant - The variant for this locale.public static java.io.File getI18nDirectory()
File value
public static java.lang.String message(java.lang.String messageId,
java.lang.String... data)
messageId - The key of the message to finddata - consists of pairs of strings, each time the first of the pair
is replaced by the second in the messages.public static boolean containsKey(java.lang.String key)
key - a String value
boolean value
public static java.lang.String getKey(java.lang.String preferredKey,
java.lang.String defaultKey)
preferredKey - a String valuedefaultKey - a String value
String valuepublic static void loadResources(java.io.File resourceFile)
resourceFile - public static final java.lang.String getName(FreeColGameObjectType object)
object - a FreeColGameObjectType value
String valuepublic static final java.lang.String getName(Typed object)
object - a Typed value
String valuepublic static final java.lang.String getName(Feature object)
object - a Feature value
String valuepublic static java.lang.String getName(Tile tile)
tile - a Tile value
String.public static java.lang.String getName(FoundingFather.FoundingFatherType type)
type - an int value
String valuepublic static final java.lang.String getDescription(FreeColObject object)
object - a FreeColObject value
String valuepublic static java.lang.String getLabel(Unit unit)
unit - an Unit value
public static java.lang.String getLabel(UnitType someType,
Unit.Role someRole)
someType - an UnitType valuesomeRole - a Role value
public static java.lang.String getLabel(Tile tile)
Tile, with the name of the tile
and any improvements on it (road/plow/etc) from TileItemContainer.
tile - a Tile value
public static java.lang.String getLabel(ColonyTile colonyTile)
colonyTile - a ColonyTile value
public static java.lang.String getLabel(Goods goods)
goods - a Goods value
public static java.lang.String getLabel(GoodsType type,
int amount)
type - a GoodsType valueamount - an int value
public static java.lang.String getLabel(TileItemContainer tic)
tic - a TileItemContainer value
public static java.lang.String getNationAsString(Player player)
player - a Player value
public static java.lang.String getLocationName(Tile tile)
public static java.lang.String getLocationName(Building building)
building - a Building value
public static java.lang.String getLocationName(ColonyTile colonyTile)
ColonyTile.
colonyTile - a ColonyTile value
public static java.lang.String getLocationName(Unit unit)
public static java.lang.String getLocationName(Location location)
getLocationName method here.
location - a Location value
String value
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||