public class TLcyLang extends Object
This class takes care of the internationalization capabilities of Lucy. Translations files are
searched by trying to find the file lucy/DefaultResources
(e.g. lucy/DefaultResources_nl.properties
)
The language is set (to Java) by using the -Duser.language=..
system property.
Lucy supports three languages:
Other languages can simply be added by translating the DefaultResourceBundle to other languages.
To translate a string into the target language, use
TLcyLang.getString(aKey)
. Lucy uses the message in English as the key. This
means if no translations are available, Lucy is in English.
When developing your own application which needs internationalization support, it is easiest to define your own resource bundles, so that you keep your own translations separate from the ones that ship with Lucy. You can do so be registering your additional bundles, for example like this:
ResourceBundle bundle = ResourceBundle.getBundle("myApp.TranslationBundle"); TLcyLang.registerResourceBundle("arbitraryID", bundle);
When requesting a translation, and the language is set to French for example, these files are checked, in this order:
The file names are interpreted relative to the classpath.
getString(java.lang.String)
Constructor and Description |
---|
TLcyLang() |
Modifier and Type | Method and Description |
---|---|
static ResourceBundle |
getDefaultResourceBundle()
Returns the default resource bundle.
|
static ResourceBundle |
getResourceBundle(String aResourceBundleID)
Returns the resource bundle associated with the given ID, or
null if there is none. |
static String |
getString(String aKey)
Returns the internationalized string corresponding to the specified key, by trying all registered resource bundles.
|
static String |
getString(String aResourceBundleID,
String aKey)
Returns the internationalized string corresponding to the specified key from the resource
bundle that is associated with the specified identifier.
|
static ILcdStringTranslator |
getStringTranslator()
Returns an
ILcdStringTranslator that translates strings
similar to getString . |
static ILcdStringTranslator |
getStringTranslator(String aResourceBundleID)
Returns an
ILcdStringTranslator that translates strings
similar to getString |
static boolean |
isClassTraceOn()
Deprecated.
This method has been deprecated. It is recommended to use the
standard Java logging framework directly.
|
static ResourceBundle |
registerResourceBundle(String aResourceBundleID,
ResourceBundle aResourceBundle)
Registers a resource bundle using a specified ID.
|
static void |
setClassTraceOn(boolean aClassTraceOn)
Deprecated.
This method has been deprecated. It is recommended to use the
standard Java logging framework directly.
|
static ResourceBundle |
setDefaultResourceBundle(ResourceBundle aResourceBundle)
Sets the default resource bundle to a specified resource bundle
|
static ResourceBundle |
unregisterResourceBundle(String aResourceBundleID)
Unregisters the resource bundle that is associated with a specified ID.
|
public static final String NEW_MAP
public static final String LASTCLICK
public static final String FILE
public static final String NEW
public static final String OPEN
public static final String LOAD
public static final String SAVE
public static final String SAVE_AS
public static final String CLOSE
public static final String DELETE
public static final String EXIT
public static final String OK
public static final String CANCEL
public static final String APPLY
public static final String MAP
public static final String PROJECTION
public static final String EDIT
public static final String COLORS
public static final String BACKGROUND
public static final String CONTROLS
public static final String EDIT_CURRENT
public static final String SHOW
public static final String WARNING
public static final String SHOW_ALL_ON
public static final String SHOW_SELECTED_ON
public static final String REMOVE_FROM
public static final String RESET
public static final String TOTE
public static final String MAX_CPU_USAGE
public static final String TIME_RANGE
public static final String TIME_FACTOR
public static final String UNCLASSIFIED
public static final String RESTRICTED
public static final String CONFIDENTIAL
public static final String SECRET
public static final String NOT_VALID_CLASSIFICATION
public static final String CAN_NOT_ADD_ELEMENT
public static final String SEC1
public static final String SEC2
public static final String SEC5
public static final String SEC10
public static final String SEC30
public static final String MIN1
public static final String MIN2
public static final String MIN5
public static final String MIN10
public static final String MIN30
public static final String PREVIEWER
public static final String PREVIEW_LAYER_NAME
public static final String MISSION_ID
public static final String ROLE
public static final String TARGET
public static final String UNIT
public static final String BASE
public static final String AIRCRAFT
public static final String NR_AIRCRAFT
public static final String SPEED
public static final String TOT
public static final String OBJ
public static final String PACKAGE
public static final String ANNEX
public static final String OVERVIEW
public static final String MAKE_OVERVIEW
public static final String INITIALIZING
public static final String APP_TITLE
public static final String DATA
public static final String AUTO_CENTER
public static final String AUTO_FIT
public static final String AUTO_RESIZE
public static final String AUTO_SELECT
public static final String UPDATE_POLYLINE
public static final String POINTLIST_ERROR
public static final String POINTLIST_ERROR_MESSAGE
public static final ResourceBundle getDefaultResourceBundle()
setDefaultResourceBundle(java.util.ResourceBundle)
public static final ResourceBundle setDefaultResourceBundle(ResourceBundle aResourceBundle)
getDefaultResourceBundle()
@Deprecated public static boolean isClassTraceOn()
true
if tracing is enabled for this class.@Deprecated public static void setClassTraceOn(boolean aClassTraceOn)
true
then all log messages are recorded, otherwise only
the informative, warning and error messages are recorded.aClassTraceOn
- if true then all log messages are recorded,
otherwise only the informative, warning and error messages are recorded.public static ILcdStringTranslator getStringTranslator()
ILcdStringTranslator
that translates strings
similar to getString
.ILcdStringTranslator
instance.getString(String)
public static ILcdStringTranslator getStringTranslator(String aResourceBundleID)
ILcdStringTranslator
that translates strings
similar to getString
aResourceBundleID
- the identifier for the resource bundle in which to search.ILcdStringTranslator
instance.getString(String, String)
public static String getString(String aKey)
aKey
- the key for which to get the internationalized stringpublic static String getString(String aResourceBundleID, String aKey)
aResourceBundleID
- the identifier for the resource bundle in which to searchaKey
- the key for which to get the internationalized stringregisterResourceBundle(java.lang.String, java.util.ResourceBundle)
public static final ResourceBundle registerResourceBundle(String aResourceBundleID, ResourceBundle aResourceBundle)
getString(String, String)
method.aResourceBundleID
- the identifier for the resource bundleaResourceBundle
- the resource bundle to registerIllegalArgumentException
- if the key or the resource bundle is nullunregisterResourceBundle(java.lang.String)
public static final ResourceBundle unregisterResourceBundle(String aResourceBundleID)
aResourceBundleID
- the identifier for the resource bundle to removeIllegalArgumentException
- if the key is nullregisterResourceBundle(java.lang.String, java.util.ResourceBundle)
public static final ResourceBundle getResourceBundle(String aResourceBundleID)
null
if there is none.aResourceBundleID
- the bundle IDnull
if there is none.