xdoclet.util

Class Translator


public final class Translator
extends java.lang.Object

Utility class for doing i18n translations.
Version:
$Revision: 1.11 $
Author:
Andrew Stevens
created
Jan 18, 2002

Method Summary

static java.lang.String
getString(Class clazz, String resourceKey)
Gets the String attribute of the Translator class.
static java.lang.String
getString(Class clazz, String resourceKey, String[] arguments)
Gets the String attribute of the Translator class.
static java.lang.String
getString(String bundleKey, String resourceKey)
Gets the String attribute of the Translator class.
static java.lang.String
getString(String bundleKey, String resourceKey, String[] arguments)
Gets the String attribute of the Translator class.

Method Details

getString

public static java.lang.String getString(Class clazz,
                                         String resourceKey)
Gets the String attribute of the Translator class.
Parameters:
clazz - Messages class containing resource key constants, from which the bundle was generated.
resourceKey - The resource key to look up in the bundle.
Returns:
The localized string

getString

public static java.lang.String getString(Class clazz,
                                         String resourceKey,
                                         String[] arguments)
Gets the String attribute of the Translator class.
Parameters:
clazz - Messages class containing resource key constants, from which the bundle was generated.
resourceKey - The resource key to look up in the bundle.
arguments - A string array of the arguments to be substituted for any placeholders ({0}, {1} etc.) in the resource value string.
Returns:
The localized string

getString

public static java.lang.String getString(String bundleKey,
                                         String resourceKey)
Gets the String attribute of the Translator class.
Parameters:
bundleKey - Bundle name, without the tailing ".resources.Messages".
resourceKey - The resource key to look up in the bundle.
Returns:
The localized string

getString

public static java.lang.String getString(String bundleKey,
                                         String resourceKey,
                                         String[] arguments)
Gets the String attribute of the Translator class.
Parameters:
bundleKey - Full bundle name, including the tailing ".resources.Messages".
resourceKey - The resource key to look up in the bundle.
arguments - A string array of the arguments to be substituted for any placeholders ({0}, {1} etc.) in the resource value string.
Returns:
The localized string